eXept Software AG Logo

Smalltalk/X Webserver

Documentation of class 'NoHandlerError':

Home

Documentation
www.exept.de
Everywhere
for:
[back]

Class: NoHandlerError


Inheritance:

   Object
   |
   +--GenericException
      |
      +--NoHandlerError

Package:
stx:libbasic
Category:
Kernel-Exceptions-Errors
Version:
rev: 1.36 date: 2024/03/26 12:55:40
user: cg
file: NoHandlerError.st directory: libbasic
module: stx stc-classLibrary: libbasic

Description:


NoHandlerError is raised, if there is no exception handler
or default action for an exception.

The parameter is the unhandled exception.

[Class variables:]
    EmergencyHandler <Block>    this block is evaluated, if no handler was defined
                                for a signal (i.e. this one is responsible for the
                                unhandled exception debugger).
                                Having this being a block allows to globally catch
                                these errors - even when no enclosing handler-scope
                                around the erroneous code exists.
                                (as the catch/through does).

copyright

COPYRIGHT (c) 1999 by eXept Software AG All Rights Reserved This software is furnished under a license and may be used only in accordance with the terms of that license and with the inclusion of the above copyright notice. This software may not be provided or otherwise made available to, or used by, any other person. No title to or ownership of the software is hereby transferred.

Class protocol:

accessing
o  defaultNotifierString

accessing emergencyHandler
o  emergencyHandler
return the handler used for unhandled exceptions.

If no EmergencyHandler has been set, a handler which enters the
debugger is returned.
The debugger is opened by asking the signal for a debug action,
this allows to provide other debuggers in specialized (subclass-instances)
of Signal (if that is ever needed)

Usage example(s):

     NoHandlerError emergencyHandler:[:ex | Transcript showCR:ex description.
					    ex signal openDebuggerOnException:ex].

o  emergencyHandler: aOneArgBlock
set the handler used for unhandled exceptions.
The default (a nil-handler) leads to a debugger to be shown.

Usage example(s):

ST-80 behavior of first showing a notifier:
     (I prefer to get right into the debugger, though)

     NoHandlerError
	emergencyHandler:
	    [:ex | self errorNotify:ex description ]

Usage example(s):

ST-X behavior of going right into the debugger:

     NoHandlerError
	emergencyHandler:nil

o  emergencyHandlerReceiver: something
if set, that one receives the
errorNotify:message
from:ex returnableSuspendedContext
allowDebug:true
mayProceed:ex mayProceed
message.
By default, this is nil, so Object's method is called.
Set it eg. to provide a different notifier

useful emergency handlers
o  abortingEmergencyHandler
return a block (usable as an emergency handler),
which aborts after showing a warnBox.
This is useful for endUser applications.

Usage example(s):

test with (try a few halts or CTRL-C's):
     NoHandlerError emergencyHandler:(NoHandlerError abortingEmergencyHandler)

o  dumpingEmergencyHandler
return a block (usable as an emergency handler),
which dumps the stackBacktrace to a trace file and
aborts after showing a warnBox.
This is useful, for endUser application, which are still being
debugged (i.e. the programmers may have a look at the traceFile
from time to time).

Notice:
The code below is just an example; you may want to change the
name of the error-file in your application
(but please: copy the code; do not modify here)

Usage example(s):

test with (try a few halts or CTRL-C's):
     NoHandlerError emergencyHandler:(NoHandlerError dumpingEmergencyHandler)

o  mailingEmergencyHandler
return a block (usable as an emergency handler),
which shows a warnBox and optionally mails a stackBacktrace to a maintainer.
This is useful, for endUser application, which are still being
debugged (i.e. the programmers may have a look at the errors).

Notice: the stuff here is a demonstration only; it should be modified
for your particular environment ...
... but please: copy the code and modify there;
leave the stuff below as it is.

Usage example(s):

test with (try a few halts or CTRL-C's):
     NoHandlerError emergencyHandler:(NoHandlerError mailingEmergencyHandler)

o  notifyingEmergencyHandler
return a block (usable as an emergency handler for exceptions),
which does errorNotification before going into the debugger.
Halts and breakpoints go directly into the debugger (without asking)

o  notifyingEmergencyHandlerForUserProcesses
return a block (usable as an emergency handler for exceptions),
which does errorNotification before going into the debugger,
but only for exceptions occurring in user processes;
systemProcesses are not debugged.
Halts and breakpoints go directly into the debugger (without asking)

Usage example(s):

test with:
     NoHandlerError emergencyHandler:(NoHandlerError notifyingEmergencyHandlerForUserProcesses)
     Object bla.


Instance protocol:

accessing
o  exception
the original exception, which was responsible for this.
ANSI compatibility

o  originalSignal
return the signal/exception which was originally raised.
For noHandler, that is my unhandled signal; for others, that's the exception itself.

o  unhandledException
the original exception, which was responsible for this.
Obsolete: use #exception for ANSI comatibility.

** This is an obsolete interface - do not use it (it may vanish in future versions) **

default actions
o  defaultAction
This action is performed, if nobody handles the NoHandlerError.
Look for either a per-process emergencyHandlerBlock
or the global emergencyHandler ...

o  defaultResumeValue
redefined to ask the underlying unhandled exception for its default resume value

o  noHandler
redefined to avoid recursive invocations

printing & storing
o  descriptionForDebugger
return the description string of the signal;
this is used in the debugger's title area

queries
o  mayProceed
return true, if the exception handler is allowed to proceed
the execution where the exception occurred.


Examples:


The emergencyHandler stuff is very useful, to prevent endUser applications from entering the debugger. Some commonly used (useful) emergency handlers are provided in the 'useful handlers' section; try them to learn more (especially, the mailingHandler is fun). Of course, these are only examples - you may define your own handler block and pass it to the #emergencyHandler: method. BTW: the Launchers 'source & debugger' settings menu allows you to install either a default or the notifying handler. A handler which shows a box, then aborts - (no more debuggers):
    NoHandlerError emergencyHandler:(NoHandlerError abortingEmergencyHandler)
A handler which aborts - (no box, no debugger):
    NoHandlerError emergencyHandler:[:ex | AbortSignal raise]
try some exception (for demonstration, in some other process):
    [
        #(1 2 3) at:4
    ] fork.
cleanup (switch back to the regular handler, which enters the debugger):
    NoHandlerError emergencyHandler:nil
A handler which shows a warnBox and asks for debugging:
    NoHandlerError emergencyHandler:(NoHandlerError notifyingEmergencyHandler)
A handler which dumps information to a file (watch the file 'errorTrace.stx'):
    NoHandlerError emergencyHandler:(NoHandlerError dumpingEmergencyHandler)
A handler which sends you mail:
    NoHandlerError emergencyHandler:(NoHandlerError mailingEmergencyHandler)


ST/X 7.7.0.0; WebServer 1.702 at 20f6060372b9.unknown:8081; Mon, 18 Nov 2024 04:24:36 GMT