-
Notifications
You must be signed in to change notification settings - Fork 235
Improve error logging for exec of pscommands #598
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is really helpful, thanks a bunch!
} | ||
|
||
// We've reported these errors, clear them so they don't keep showing up. | ||
this.powerShell.Streams.Error.Clear(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Weird, I could have sworn I added code for this in the past.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And there very well could be a better place to put this call. I contemplated clearing the error collection at the beginning of the method, before it runs the PSCommand. But I stuck with only clearing after reporting error message. BTW they weren't getting cleared. I kept seeing the same two import failures ($pseditor null) for every subsequent execution - profile loading, prompt eval, etc.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nah, this is the right place to do it. I just couldn't believe I hadn't actually added the code. Probably was in a branch somewhere that never got merged :/
* Improve error logging for exec of pscommands * Handle null ScriptStackTrace - not sure it's possible but just in case * Tweak log output format and kick new build
This improves the output to the EditorServices.log file from:
to
NOTE: While the two errors above "look" identical they actually arise from different lines of
BuiltInCommands.ps1
.