Get-PnpException how to get exception for last command or clear the history #1764
-
How can I tell if a command has an exception occur when Get-PnpException provides the last exception regardless of when that happened? Eg
The only way I have been able to detect if a Pnp command errors is to capture the output, which makes me wonder when is Get-PnpException of any use. Is there a way to either clear Get-PnpException history or ideally set each pnp command to clear the history? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Hey Usually I use try/catch, but you have to either set If you provide a sample of your issue I might better understand your specific issue Get-PnPException just shows latest error in error stream in a readable format ($Error[0]) |
Beta Was this translation helpful? Give feedback.
Hey
Usually I use try/catch, but you have to either set
-Erroraction Stop
For that to work (not all exceptons are terminal) or set error level globally to stop
If you provide a sample of your issue I might better understand your specific issue
Get-PnPException just shows latest error in error stream in a readable format ($Error[0])