Created
January 6, 2019 09:38
-
-
Save nohwnd/02dd7af0fac84b1d379810727458a852 to your computer and use it in GitHub Desktop.
Navigatable stack trace
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function a () { | |
b | |
} | |
function b () { | |
c | |
} | |
function c () { | |
throw "error" | |
} | |
try { | |
a | |
} catch { | |
"Standard output:" | |
$_ | |
"Full stack trace:" | |
$_.ScriptStackTrace | Out-String | | |
# change the output | |
# from: at file.ps1 line 13 | |
# to: at file.ps1:13 | |
foreach { $_ -replace '\s*line\s+(\d+)','$1'} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment