slloyd
19th December 2007 19:29 UTC
Discussion on Nullsoft Error Handling
I was hoping to start a discussion on error handling. I have been using nullsoft for quite some time and still find it quite difficult, if not impossible, to determine what causes some errors. I am interested in how others are handling errors and whether or not they feel the error handling in nullsoft lacking. Mostly, I would love to be able to capture the windows error(number or message) for errors. Some examples of problems I have had are:
- CopyFiles errors: Copy failed when the file on a CD had a crc error. The script called CopyFiles on a directory with many files so I was unable to determine what one failed. The only way I was able to determine what happened is to manually try to copy each file from the CD until I saw the windows error.
- RegDLL errors: Unable to see the failure message when registering a dll or ocx file. It would sure be nice to capture the windows error on this one also.
carlosfocker
19th December 2007 20:08 UTC
I agree that error handling should be beefed up. Making your installer easy to troubleshoot is i feel an important aspect to consider while coding your installer. A suggestion would be able to set a type of error rather than a generic one. Kind of like a sudo exception. Then you could check to see if FileNotFoundError was set.
For my current error handling techniques, I include a detailedprint in the functions or macros I build to declare problems. An example would be:
StrCpy $R0 "c:\test\file.txt"
IfFileExists $R0 FileExists FileNotExists
FileExists:
FileNotExists:
detailprint 'Error: $R0 does not exist.'
Building this into my macros at least gives me some type of clue when it fails.
Also, to centralize my error catching and notification, I created a macro that checks if errors were set and prints a specified message in the installer console or a messagebox.
kichik
23rd February 2008 12:52 UTC
End of discussion?
carlosfocker
24th February 2008 17:37 UTC
I guess it isn't that important to anybody.
Daniel James
11th March 2008 20:22 UTC
Re: Discussion on Nullsoft Error Handling
Originally posted by slloyd
I was hoping to start a discussion on error handling.
I'm glad you did! Pity it didn't get further.
Mostly, I would love to be able to capture the windows error(number or message) for errors.
I agree. It would be very nice to have a $ERROR variable that could be checked just as one checks errno in C, or a GetLastError function, and some way to return a textual error message based on this (in the local language, of course).
It might also be nice to have some sort of ON ERROR construct (as in Basic), but I'm not sure it wold be easy to get agreement on the most useful semantics for that :)
yilmaz
28th August 2008 03:54 UTC
error handling
I am so surprised and disappointed to know taht NSIS does not have a useful error handling mechanism.
Hopefully in the next version, NSIS adds this feature.
Otherwise, we will keep on guessing on errors :(
Sheik
29th August 2008 16:56 UTC
Or even better, have a callback function that we can set up that NSIS will call when it detects an error during the install of files.
We have lots of .On* functions, why not .OnError where it sends us the filename, location where it was to be installed, filesize. We can parse it, determine if we care about it or not, and send back some sort of code, like "IGNORE" or "RETRY" to tell NSIS what to do about the error.