Replies: 1 comment 3 replies
-
@mjr4077au stackoverflow.com is in my opinion a better place to ask your questions. I'm not sure I understand your need but it appears that you don't know the $PSCmdlet variable. Hope this link can help you. |
Beta Was this translation helpful? Give feedback.
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Possibly not worded well, but I'll try to explain.
I'm currently using PowerShell transcriptions for logging purposes. When a function throws a terminating error, the transcription will show the following for every function in the call stack until it hits the catch block:
PS>TerminatingError(): "test throw"
.If I'm catching a throw within the same scope (
try {throw 'test throw'} catch {...}
), there's noPS>TerminatingError(): "test throw"
line in the transcription, which means I need to write one out myself.The problem here is for situations where if I just blindly write out the message myself, I'll get a look that's like:
Ideally I'd like to not write my own line if I know the transcriber has caught a terminating error and logged it as
PS>TerminatingError(): "test throw"
.Is there any robust way to check for this? This is mainly for my lynch-pin main try/catch block. Moving the catches closer isn't necessarily an option.
Beta Was this translation helpful? Give feedback.
All reactions