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.
An error occurred while saving the commentLiam Fisher commented
Hi Beth, why is the invocation info not shown in the runbook error message? This is useful information and I constantly end up writing a horrible trap block that prints out the invocationinfo position and message on failure. I believe that is the information the OP was looking for.