Roman Kuzmin
unread,Aug 10, 2011, 1:03:52 AM8/10/11Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to psake-dev
Error messages do not include source information, the most important
piece.
Compare:
psake message:
The term 'Test1' is not recognized as the name of a cmdlet, function,
script file, or operable program. Check the spelling of the name, or
if a path was included,
verify that the path is correct and try again.
classic message:
The term 'Test1' is not recognized as the name of a cmdlet, function,
script file, or operable program. Check the spelling of the name, or
if a path was included,
verify that the path is correct and try again.
At C:\TEMP\default.ps1:5 char:7
+ Test1 <<<<
+ CategoryInfo : ObjectNotFound: (Test1:String) [],
CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
Classic error messages show the source and even point to the piece of
line with an error.
I know about
$config.verboseError = 1
, tried this and did not really find it useful. It is verbose too
much, all I want is to see the file name and the line number. In
verbose messages it takes too long to find this information.
I would propose to change the line:
$error_message = "{0}: An Error Occurred: `n{1}" -f (Get-
Date), $_
To
$error_message = "{0}: An Error Occurred: `n{1}" -f (Get-
Date), ($_ | Out-String)
This change makes error source shown in messages.
Alternatively, there might be more levels of verbosity, that is:
$config.verboseError = 0 # just like now, very brief error message
$config.verboseError = 1 # like I propose with source information
$config.verboseError = 2 # like it is verbose now.