[wpkg-users] wpkg.js crashing?

Brian May brian at vpac.org
Mon Apr 21 01:58:31 CEST 2008


Rainer Meier wrote:
> On the other side Brian might have another issue as well. Hopefully 
> there is some error within his event logs he could provide.

Of course I don't have anything in my event logs, it is this code which 
is causing the wpkg to prematurely abort.

Can I please request the following change:

function log(type, description) {
         // just log information level to event log or everything in 
case debug is
         // enabled.
         if ((type & 7) > 0 || isDebug()) {
                 if(isQuiet()) {
                         try {
                                 WshShell = 
WScript.CreateObject("WScript.Shell");
                                 WshShell.logEvent(type, description);
                         } catch (e) {
                                 getLogFile().WriteLine("Error when 
logging to event handler:      " + e.message + "\n" +
                                                 "Description:  " + 
e.description + "\n" +
                                                 "Error number: " + 
hex(e.number) + "\n" +
                                                 "Stack:        " + 
e.stack  + "\n" +
                                                 "Line:         " + 
e.lineNumber + "\n" +
                                                 "Message:      " + 
description + "\n"
                                                 );
                                 throw(e);
                         }
                 } else {
                         alert(description);
                 }
         }


...


On my system this logs:

Error when logging to event handler:
Description:
Error number: 800705de
Stack:        undefined
Line:         undefined
Message:      User notification suppressed. Message: The automated 
software installation utility has or is currently applying software u
pdates to your system. Please check the time shown at the beginning of 
this message to determine if it is out of date. If not, please sa
ve all your open documents, as the system might require a reboot. If so, 
the system will be rebooted with no warning when installation i
s complete. Thank you.

Error when logging to event handler:
Description:
Error number: 800705de
Stack:        undefined
Line:         undefined
Message:      Message:      Unable to notify user that the system was 
about to begin updating.
Description:  Unable to notify user that the system was about to begin 
updating.
Error number: 100000000
Stack:        undefined
Line:         undefined




The first message "User notification suppressed...." is when it tries to 
log the first info message. This generates an exception because logging 
to the event handler failed.

This exception is rethrown and caught by notifyUserStart, which
throws the exception Error(0, "Unable to notify user that the system was 
" + "about to begin updating. " + e.description);

This is caught by the top level exception handler which tries to log the 
message by calling log, which in turn tries to write to the event 
handler, which creates another exception. My exception handler catches 
it, logs it, throws it again.

There is no exception handler to catch this error, so the program aborts.

Yes, the program still aborts, but at least now the reason is recorded,
assuming the log file works (if the log file doesn't work your stuffed 
regardless).

Now to debug the issue with the event handler.

Brian May




More information about the wpkg-users mailing list