Can I get detailed exception stacktrace in PowerShell?

前端 未结 12 1141
暗喜
暗喜 2020-12-02 12:23

Runing such script:

 1: function foo()
 2: {
 3:    bar
 4: }
 5: 
 6: function bar()
 7: {
 8:     throw \"test\"
 9: }
10: 
11: foo

I see

12条回答
  •  悲&欢浪女
    2020-12-02 12:37

    I just figured it out. The $_ is the exception caught in the catch block.

    $errorString= $_ | Out-String 
    

提交回复
热议问题