Replaced existing ResolveError with a modified variant that includes a short view, so that exceptions can be represented as one-liners for build output parsing purposes (it special cases Sql Exceptions as well to dig into the real errors)
Replaced existing ResolveError with a modified variant that includes a short view, so that exceptions can be represented as one-liners for build output parsing purposes (it special cases Sql Exceptions as well to dig into the real errors)

Relies on new SelectObjectWithDefault function that can safely read properties off of objects w/out adding to the $Error collection (oddly, I've found this necessary when using WinRM, so I left that code in)

For instance, a short representation of an Error looks like this:
Error:  At C:\source\project\build\modules\Sql.psm1:175 char:36 +   [Void]$database.ExecuteNonQuery <<<< ($commands) [<<==>>] Exception: Exception calling "ExecuteNonQuery" with "1" argument(s): "ExecuteNonQuery failed for Database 'a73fa37f891e46bbab9e2b23b8f87c56'. " --> ExecuteNonQuery failed for Database 'a73fa37f891e46bbab9e2b23b8f87c56'.  --> An exception occurred while executing a Transact-SQL statement or batch. --> Foreign key 'fk_file_cabinet_num' references invalid column 'file_cabinet_num' in referencing table 'file_cabinet_files'.Could not create constraint. See previous errors. --> (Line [4] Proc
edure [] Class [16]  Number [1769] State [1] )

This is much more actionable / easier to read than 50 lines of output from an Exception with 4 InnerExceptions

psake/psake