Emit errors using Write-Error

This commit is contained in:
Manuel Thalmann 2024-08-17 13:49:21 +02:00
parent 8d7835a8aa
commit 9e716bce4f
2 changed files with 3 additions and 3 deletions

View file

@ -110,7 +110,7 @@ $null = New-Module {
$result; $result;
} }
catch { catch {
throw $Error; Write-Error "$Error";
} }
} }
} }
@ -156,7 +156,7 @@ $null = New-Module {
if ($element) { if ($element) {
$Browser.FindElement([OpenQA.Selenium.By]::CssSelector($ButtonSelector)).Click(); $Browser.FindElement([OpenQA.Selenium.By]::CssSelector($ButtonSelector)).Click();
} else { } else {
throw "Unable to find download button!"; Write-Error "Unable to find download button!";
} }
}; };
} }

View file

@ -113,7 +113,7 @@ $null = New-Module {
if (Test-Path $errorPath) { if (Test-Path $errorPath) {
$errorMessage = Get-Content $errorPath; $errorMessage = Get-Content $errorPath;
Remove-Item $errorPath; Remove-Item $errorPath;
throw $errorMessage; Write-Error $errorMessage;
} }
} }