Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ErrorAction and Errorlist #155

Open
BenjaminNiemann opened this issue Aug 16, 2023 · 1 comment
Open

ErrorAction and Errorlist #155

BenjaminNiemann opened this issue Aug 16, 2023 · 1 comment

Comments

@BenjaminNiemann
Copy link

Hey there,
in non-interactive mode (-silent parameter), a wonderful and informative log is generated. However, setting the -ErrorAction parameter to "Stop" does not result in script termination. Perhaps you may not want the script to abort on every error, but only on errors related to the Graph API. Is there a planned approach for handling errors? Alternatively, a deterministic return value indicating whether errors occurred could also suffice. This would be very helpful.

Hope you can help :-)

@Micke-K
Copy link
Owner

Micke-K commented Aug 16, 2023

Hello,

This is by design. Errors are either silenced by try/catch or SilentlyContinue.

However, they are normally sent to the Write-Log function as errors so you could add an exit there if an error occurred.

I have the opposite option in Settings eg log errors as warnings to not stop automation that would look at script errors. I could in theory add an option to exit if an error occurs but there are some "acceptable" errors so this might kill the script even if it is working.

Cheers!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants