giả sử tôi có mã sau, khi lỗi xảy ra, tôi muốn thấy lỗi xảy ra lần đầu tiên ở hàm b, và sau đó xảy ra ở hàm a. Nhưng trong thực tế, nó chỉ nói với tôi những lỗi xảy ra ở chức năng một, vì chức năng một có thể được gọi nhiều lần, tôi không biết đó là ngoài chức năng gọi hàm một gây ra vấn đềpowershell: cách in tổng số ngăn xếp cuộc gọi khi xảy ra lỗi?
cls
function a{
Remove-Item "not-exist-item"
}
function b{
a
}
b
Remove-Item : Cannot find path 'C:\Program Files (x86)\Microsoft SQL Server\100\Tools\Binn\not-exis t-item' because it does not exist. At C:\Users\Daniel.Wu\AppData\Local\Temp\2\a.ps1:***3 char:14*** + Remove-Item <<<< "not-exist-item" + CategoryInfo : ObjectNotFound: (C:\Program File...\not-exist-item:String) [Remove-Item], ItemNotFoundException + FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShell.Commands.RemoveItemCommand