Quantcast
Channel: PowerShell App Deployment Toolkit
Viewing all articles
Browse latest Browse all 2341

Edited Unassigned: Feature Request: Standardize and improve error message display [76]

$
0
0
Sometimes it is hard to track down where an error message came from and also what the exact error actually is. Also, error details can sometimes be hidden in $_.Exception.InnerException and there can be more than one of these.

Thus, it would be nice if the toolkit had a function for displaying a standard set of the most useful error record details with the following features:
1) Display the most useful error record details by default. In my opinion, the most useful error message details are as such: Message, FullyQualifiedErrorId, ScriptStackTrace, PositionMessage, InnerException.
2) The function should be versatile enough so that you can specify whatever properties you which to display for the error record.
3) Display all $_.Exception.InnerException messages if they exist.
4) If you use a cmdlet and specify the -ErrorVariable parameter for it to store all errors, you should be able to examine/log all of the error messages that the cmdlet produced.

Attached, you will find a working solution for what I have just described.

To use this function in the toolkit, we would simply need to replace every spot where we display error information with a call to the function like such:
Write-Log "Failed to install MSI `n$(Resolve-Error)"


Viewing all articles
Browse latest Browse all 2341

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>