Can you provide more detail on what you mean by useful? Do you want to know where in the code the error occurred? Can you provide an example of what you find useful for debugging PS in the ISE?
You may want to try using ErrorRecord.InvocationInfo for non-terminating errors since on non-terminating errors, we currently save this data in the Error stream.
On terminating errors (exceptions), this data is currently lost. But we can investigate storing this information to present it for debugging. I would like to make sure that this is the info that you are looking for though, so please confirm.
As a workaround for now, you could write a global try/catch block in the runbook (which will also catch exceptions thrown because of $ErrorActionPreference = ‘Stop’) and write $_.ErrorRecord.InvocationInfo to a stream.Timothy shared this idea ·
This is a very interesting idea and one I like a lot! Let me dig into whether this is something we could consider in the future. Thanks for the idea! :)Timothy supported this idea ·