diff options
| author | Alexander Karatarakis <alkarata@microsoft.com> | 2017-11-03 16:39:43 -0700 |
|---|---|---|
| committer | Alexander Karatarakis <alkarata@microsoft.com> | 2017-11-03 16:39:43 -0700 |
| commit | a4dc2d2ef29654df9587d60f586c2eea16dedaaf (patch) | |
| tree | 755ca6dacdfc4e70415d31ac5f08ffa3004810f8 | |
| parent | 9dc02f48b65618ab7f89c5a004a3d81fc882af32 (diff) | |
| download | vcpkg-a4dc2d2ef29654df9587d60f586c2eea16dedaaf.tar.gz vcpkg-a4dc2d2ef29654df9587d60f586c2eea16dedaaf.zip | |
[fetchDependency.ps1] Improve error message on hash mismatch
| -rw-r--r-- | scripts/fetchDependency.ps1 | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/scripts/fetchDependency.ps1 b/scripts/fetchDependency.ps1 index 6788b5e7e..593cba2a6 100644 --- a/scripts/fetchDependency.ps1 +++ b/scripts/fetchDependency.ps1 @@ -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 |
