Getting exceptions instead of friendly warnings #9383
Answered
by
MaxGripe
mfsalomons
asked this question in
Q&A
-
I want exceptions so I can create alert when a script fails. Currently with the code:
I still get the friendly warning if the user does not exists: How can I catch this error / warning? My attempts to get an exception have failed. |
Beta Was this translation helpful? Give feedback.
Answered by
MaxGripe
Jun 19, 2024
Replies: 1 comment 1 reply
-
Might be a silly idea, but have you tried setting |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
mfsalomons
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Might be a silly idea, but have you tried setting
$WarningPreference = 'Stop'
(or'Inquire'
) before your try and catch block?