Exception.st
changeset 12 8e03bd717355
parent 3 24d81bf47225
child 44 b262907c93ea
equal deleted inserted replaced
11:6bf3080856be 12:8e03bd717355
    11 "
    11 "
    12 
    12 
    13 Object subclass:#Exception
    13 Object subclass:#Exception
    14          instanceVariableNames:'signal parameter suspendedContext handlerContext
    14          instanceVariableNames:'signal parameter suspendedContext handlerContext
    15                                 resumeBlock rejectBlock'
    15                                 resumeBlock rejectBlock'
    16          classVariableNames:''
    16          classVariableNames:'EmergencyHandler'
    17          poolDictionaries:''
    17          poolDictionaries:''
    18          category:'Kernel-Exceptions'
    18          category:'Kernel-Exceptions'
    19 !
    19 !
    20 
    20 
    21 Exception comment:'
    21 Exception comment:'
    22 
    22 
    23 COPYRIGHT (c) 1993 by Claus Gittinger
    23 COPYRIGHT (c) 1993 by Claus Gittinger
    24               All Rights Reserved
    24               All Rights Reserved
    25 
    25 
       
    26 $Header: /cvs/stx/stx/libbasic/Exception.st,v 1.4 1993-12-11 00:46:23 claus Exp $
       
    27 '!
       
    28 
       
    29 !Exception class methodsFor:'documentation'!
       
    30 
       
    31 documentation
       
    32 "
    26 Instances of Exception are passed to a Signal handling block as argument.
    33 Instances of Exception are passed to a Signal handling block as argument.
    27 The handler block may perform various actions by sending corresponding messages
    34 The handler block may perform various actions by sending corresponding messages
    28 to the exception handler. The following actions are possible:
    35 to the exception handler. The following actions are possible:
    29 
    36 
    30         reject          - dont handle this signal;
    37         reject          - dont handle this signal;
    39 
    46 
    40         restart         - restart the Signal>>handle:do:, after repairing
    47         restart         - restart the Signal>>handle:do:, after repairing
    41 
    48 
    42 Via the Exception object, the handler can also query the state of execution,
    49 Via the Exception object, the handler can also query the state of execution,
    43 where the Signal was raised.
    50 where the Signal was raised.
       
    51 "
       
    52 ! !
    44 
    53 
    45 $Header: /cvs/stx/stx/libbasic/Exception.st,v 1.3 1993-10-13 00:15:42 claus Exp $
    54 !Exception class methodsFor:'initialization'!
    46 '!
    55 
       
    56 initialize
       
    57     EmergencyHandler := [:ex :con |
       
    58         (ex signal) error:('unhandled exception: ' , ex signal notifierString)
       
    59     ]
       
    60 ! !
       
    61 
       
    62 !Exception class methodsFor:'defaults'!
       
    63 
       
    64 emergencyHandler
       
    65     "return the handler used for unhandled exceptions"
       
    66 
       
    67     ^ EmergencyHandler
       
    68 !
       
    69 
       
    70 emergencyHandler:aTwoArgBlock
       
    71     "set the handler used for unhandled exceptions"
       
    72 
       
    73     EmergencyHandler := aTwoArgBlock
       
    74 ! !
    47 
    75 
    48 !Exception methodsFor:'accessing'!
    76 !Exception methodsFor:'accessing'!
    49 
    77 
    50 signal
    78 signal
    51     "return the signal, that caused the exception"
    79     "return the signal, that caused the exception"