Emit errors using Write-Error

This commit is contained in:
Manuel Thalmann 2024-08-17 13:49:21 +02:00
parent 9cf18d32bc
commit 8ba7e2b210
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;
} }
} }