From 5cb5d2e166d830126808db8f380f0aa856074eac Mon Sep 17 00:00:00 2001 From: AnyOldName3 Date: Wed, 25 Oct 2023 18:07:26 +0100 Subject: [PATCH] Add error handling to Store-Symbols.ps1 --- CI/Store-Symbols.ps1 | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/CI/Store-Symbols.ps1 b/CI/Store-Symbols.ps1 index 8634181432..11938fa4b4 100644 --- a/CI/Store-Symbols.ps1 +++ b/CI/Store-Symbols.ps1 @@ -1,3 +1,5 @@ +$ErrorActionPreference = "Stop" + if (-Not (Test-Path CMakeCache.txt)) { Write-Error "This script must be run from the build directory." @@ -8,6 +10,9 @@ if (-Not (Test-Path .cmake\api\v1\reply\index-*.json) -Or -Not ((Get-Content -Ra Write-Output "Running CMake query..." New-Item -Type File -Force .cmake\api\v1\query\codemodel-v2 cmake . + if ($LASTEXITCODE -ne 0) { + Write-Error "Command exited with code $LASTEXITCODE" + } Write-Output "Done." } @@ -45,13 +50,26 @@ finally if (-not (Test-Path symstore-venv)) { python -m venv symstore-venv + if ($LASTEXITCODE -ne 0) { + Write-Error "Command exited with code $LASTEXITCODE" + } } $symstoreVersion = "0.3.4" if (-not (Test-Path symstore-venv\Scripts\symstore.exe) -or -not ((symstore-venv\Scripts\pip show symstore | Select-String '(?<=Version: ).*').Matches.Value -eq $symstoreVersion)) { symstore-venv\Scripts\pip install symstore==$symstoreVersion + if ($LASTEXITCODE -ne 0) { + Write-Error "Command exited with code $LASTEXITCODE" + } } + $artifacts = $artifacts | Where-Object { Test-Path $_ } + Write-Output "Storing symbols..." + symstore-venv\Scripts\symstore --compress --skip-published .\SymStore @artifacts +if ($LASTEXITCODE -ne 0) { + Write-Error "Command exited with code $LASTEXITCODE" +} + Write-Output "Done."