mirror of
https://github.com/microsoft/vcpkg.git
synced 2025-01-18 09:53:01 +08:00
[fetchDependency.ps1] Improve error message on hash mismatch
This commit is contained in:
parent
9dc02f48b6
commit
a4dc2d2ef2
@ -239,9 +239,14 @@ function SelectProgram([Parameter(Mandatory=$true)][string]$Dependency)
|
||||
$downloadedFileHash = -Join ($hashByteArray | ForEach-Object {"{0:x2}" -f $_})
|
||||
}
|
||||
|
||||
$downloadedFileHash = $downloadedFileHash.ToLower()
|
||||
if ($expectedDownloadedFileHash -ne $downloadedFileHash)
|
||||
{
|
||||
throw [System.IO.FileNotFoundException] ("Mismatching hash of the downloaded " + $Dependency)
|
||||
Write-Host ("`nFile does not have expected hash:`n" +
|
||||
" File path: [ $downloadPath ]`n" +
|
||||
" Expected hash: [ $expectedDownloadedFileHash ]`n" +
|
||||
" Actual hash: [ $downloadedFileHash ]`n")
|
||||
throw "Invalid Hash"
|
||||
}
|
||||
|
||||
if ($extractionType -eq $ExtractionType_NO_EXTRACTION_REQUIRED)
|
||||
@ -270,7 +275,7 @@ function SelectProgram([Parameter(Mandatory=$true)][string]$Dependency)
|
||||
|
||||
if (-not (Test-Path $executableFromDownload))
|
||||
{
|
||||
throw [System.IO.FileNotFoundException] ("Could not detect or download " + $Dependency)
|
||||
throw ("Could not detect or download " + $Dependency)
|
||||
}
|
||||
|
||||
return $executableFromDownload
|
||||
|
Loading…
Reference in New Issue
Block a user