Skip to content

Enhance error handling in Set-PSHTMLTag #163

@Stephanevg

Description

@Stephanevg

allow better tracabbility of errors in New-PSHTMLTag.

using the following snipet from Nownd:

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'}
}

source --> https://gist.github.com/nohwnd/02dd7af0fac84b1d379810727458a852

Metadata

Metadata

Assignees

Labels

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions