Exception.st
author Stefan Vogel <sv@exept.de>
Fri, 23 Jul 1999 20:13:00 +0200
changeset 4447 b41133d7941b
parent 4445 7011a3da6c72
child 4449 c8e195e21aab
permissions -rw-r--r--
Add signal creation methods.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
     1
"
a27a279701f8 Initial revision
claus
parents:
diff changeset
     2
 COPYRIGHT (c) 1993 by Claus Gittinger
171
129f0e2e23df handling now in Exception
claus
parents: 142
diff changeset
     3
	      All Rights Reserved
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
     4
a27a279701f8 Initial revision
claus
parents:
diff changeset
     5
 This software is furnished under a license and may be used
a27a279701f8 Initial revision
claus
parents:
diff changeset
     6
 only in accordance with the terms of that license and with the
a27a279701f8 Initial revision
claus
parents:
diff changeset
     7
 inclusion of the above copyright notice.   This software may not
a27a279701f8 Initial revision
claus
parents:
diff changeset
     8
 be provided or otherwise made available to, or used by, any
a27a279701f8 Initial revision
claus
parents:
diff changeset
     9
 other person.  No title to or ownership of the software is
a27a279701f8 Initial revision
claus
parents:
diff changeset
    10
 hereby transferred.
a27a279701f8 Initial revision
claus
parents:
diff changeset
    11
"
a27a279701f8 Initial revision
claus
parents:
diff changeset
    12
a27a279701f8 Initial revision
claus
parents:
diff changeset
    13
Object subclass:#Exception
1118
1037616d9add ignore unhandled querySignals
Claus Gittinger <cg@exept.de>
parents: 1038
diff changeset
    14
	instanceVariableNames:'signal parameter errorString suspendedContext handlerContext
4438
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3509
diff changeset
    15
		rejected originator resumeBlock rejectBlock proceedable'
1118
1037616d9add ignore unhandled querySignals
Claus Gittinger <cg@exept.de>
parents: 1038
diff changeset
    16
	classVariableNames:'EmergencyHandler RecursiveExceptionSignal'
1037616d9add ignore unhandled querySignals
Claus Gittinger <cg@exept.de>
parents: 1038
diff changeset
    17
	poolDictionaries:''
1037616d9add ignore unhandled querySignals
Claus Gittinger <cg@exept.de>
parents: 1038
diff changeset
    18
	category:'Kernel-Exceptions'
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
    19
!
a27a279701f8 Initial revision
claus
parents:
diff changeset
    20
4445
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
    21
Exception class instanceVariableNames:'NotifierString'
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
    22
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
    23
"
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
    24
 The following class instance variables are inherited by this class:
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
    25
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
    26
	Object - 
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
    27
"
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
    28
!
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
    29
1953
c8a3af54acb3 unhandled querySignals should return nil
Claus Gittinger <cg@exept.de>
parents: 1710
diff changeset
    30
!Exception class methodsFor:'documentation'!
12
8e03bd717355 *** empty log message ***
claus
parents: 3
diff changeset
    31
88
81dacba7a63a *** empty log message ***
claus
parents: 77
diff changeset
    32
copyright
81dacba7a63a *** empty log message ***
claus
parents: 77
diff changeset
    33
"
81dacba7a63a *** empty log message ***
claus
parents: 77
diff changeset
    34
 COPYRIGHT (c) 1993 by Claus Gittinger
171
129f0e2e23df handling now in Exception
claus
parents: 142
diff changeset
    35
	      All Rights Reserved
88
81dacba7a63a *** empty log message ***
claus
parents: 77
diff changeset
    36
81dacba7a63a *** empty log message ***
claus
parents: 77
diff changeset
    37
 This software is furnished under a license and may be used
81dacba7a63a *** empty log message ***
claus
parents: 77
diff changeset
    38
 only in accordance with the terms of that license and with the
81dacba7a63a *** empty log message ***
claus
parents: 77
diff changeset
    39
 inclusion of the above copyright notice.   This software may not
81dacba7a63a *** empty log message ***
claus
parents: 77
diff changeset
    40
 be provided or otherwise made available to, or used by, any
81dacba7a63a *** empty log message ***
claus
parents: 77
diff changeset
    41
 other person.  No title to or ownership of the software is
81dacba7a63a *** empty log message ***
claus
parents: 77
diff changeset
    42
 hereby transferred.
81dacba7a63a *** empty log message ***
claus
parents: 77
diff changeset
    43
"
81dacba7a63a *** empty log message ***
claus
parents: 77
diff changeset
    44
!
81dacba7a63a *** empty log message ***
claus
parents: 77
diff changeset
    45
12
8e03bd717355 *** empty log message ***
claus
parents: 3
diff changeset
    46
documentation
8e03bd717355 *** empty log message ***
claus
parents: 3
diff changeset
    47
"
4445
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
    48
    Exception and its subclasses implement the same protocal as Signal.
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
    49
    So class based exceptions may be implemented as subclasses of Exception.
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
    50
68
59faa75185ba *** empty log message ***
claus
parents: 54
diff changeset
    51
    Instances of Exception are passed to a Signal handling block as argument.
59faa75185ba *** empty log message ***
claus
parents: 54
diff changeset
    52
    The handler block may perform various actions by sending corresponding messages
142
c7844287bddf *** empty log message ***
claus
parents: 130
diff changeset
    53
    to the exception object. The following actions are possible:
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
    54
4445
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
    55
        reject          - dont handle this signal;
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
    56
                          another handler will be searched for, 
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
    57
                          upper in the calling hierarchy
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
    58
4445
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
    59
        proceed         - return from the Signal>>raise, with nil as value
142
c7844287bddf *** empty log message ***
claus
parents: 130
diff changeset
    60
4445
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
    61
        proceedWith:val - same, but return val from Signal>>raise
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
    62
4445
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
    63
        return          - return from the Signal>>handle:do:, with nil as value
142
c7844287bddf *** empty log message ***
claus
parents: 130
diff changeset
    64
4445
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
    65
        returnWith:val  - same, but return val from Signal>>handle:do:
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
    66
                          (this is also the handlers default, 
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
    67
                           if it falls through; taking the handlerBlocks value
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
    68
                           as return value)
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
    69
4445
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
    70
        restart         - restart the Signal>>handle:do:, after repairing
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
    71
142
c7844287bddf *** empty log message ***
claus
parents: 130
diff changeset
    72
    Via the Exception object, the handler can also query the state of execution:
68
59faa75185ba *** empty log message ***
claus
parents: 54
diff changeset
    73
    where the Signal was raised, where the handler is, the signal which caused
142
c7844287bddf *** empty log message ***
claus
parents: 130
diff changeset
    74
    the error and the errorString passed when the signal was raised. Also, an optional
c7844287bddf *** empty log message ***
claus
parents: 130
diff changeset
    75
    parameter can be passed - the use is signal specific.:
44
b262907c93ea *** empty log message ***
claus
parents: 12
diff changeset
    76
1274
5a2f44fe1559 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1118
diff changeset
    77
    [instance variables:]
4445
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
    78
        signal           <Signal>     the signal which caused the exception
142
c7844287bddf *** empty log message ***
claus
parents: 130
diff changeset
    79
4445
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
    80
        parameter        <Object>     a parameter (if any) which was passed when raising
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
    81
                                      the signal (only if raised with #raiseWith:aParameter)
142
c7844287bddf *** empty log message ***
claus
parents: 130
diff changeset
    82
4445
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
    83
        errorString      <String>     an errorString 
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
    84
                                      (usually the signals own errorString, but sometimes
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
    85
                                       changed explicitely in #raiseWith:errorString:)
44
b262907c93ea *** empty log message ***
claus
parents: 12
diff changeset
    86
4445
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
    87
        suspendedContext <Context>    the context in which the raise occured
142
c7844287bddf *** empty log message ***
claus
parents: 130
diff changeset
    88
4445
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
    89
        handlerContext   <Context>    the context of the handler (if any)
142
c7844287bddf *** empty log message ***
claus
parents: 130
diff changeset
    90
4445
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
    91
        resumeBlock      <Block>      private to the exception; needed to perform resume action
44
b262907c93ea *** empty log message ***
claus
parents: 12
diff changeset
    92
4445
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
    93
        rejectBlock      <Block>      private to the exception; needed to perform reject action
44
b262907c93ea *** empty log message ***
claus
parents: 12
diff changeset
    94
142
c7844287bddf *** empty log message ***
claus
parents: 130
diff changeset
    95
    In case of an unhandled signal raise, Exceptions EmergenyHandler will be evaluated. 
68
59faa75185ba *** empty log message ***
claus
parents: 54
diff changeset
    96
    The default emergeny handler will enter the debugger.
142
c7844287bddf *** empty log message ***
claus
parents: 130
diff changeset
    97
68
59faa75185ba *** empty log message ***
claus
parents: 54
diff changeset
    98
    For applications, which do not want Debuggers to come up, other handlers are
59faa75185ba *** empty log message ***
claus
parents: 54
diff changeset
    99
    possible.
362
claus
parents: 345
diff changeset
   100
    For example, to get the typical C++ behavior, use:
4445
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   101
        Exception emergencyHandler:[:ex | Smalltalk exitWithCoreDump]
68
59faa75185ba *** empty log message ***
claus
parents: 54
diff changeset
   102
1274
5a2f44fe1559 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1118
diff changeset
   103
5a2f44fe1559 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1118
diff changeset
   104
    [Class variables:]
4445
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   105
        EmergencyHandler <Block>    this block is evaluated, if no handler was defined
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   106
                                    for a signal (i.e. this one is responsible for the
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   107
                                    unhandled exception debugger).
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   108
                                    Having this being a block allows to globally catch
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   109
                                    these errors - even when no enclosing handler-scope
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   110
                                    around the erronous code exists.
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   111
                                    (as the catch/through does).
171
129f0e2e23df handling now in Exception
claus
parents: 142
diff changeset
   112
4445
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   113
        RecursiveExceptionSignal
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   114
                         <Signal>   raised when within a handler for some signal,
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   115
                                    the same signal is raised again.
1274
5a2f44fe1559 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1118
diff changeset
   116
5a2f44fe1559 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1118
diff changeset
   117
5a2f44fe1559 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1118
diff changeset
   118
    [see also:]
4445
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   119
        Signal  SignalSet QuerySignal
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   120
        Context Block
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   121
        Object DebugView
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   122
        (``Exception handling and signals'': programming/exceptions.html)
1292
89497fff7f87 documentation
Claus Gittinger <cg@exept.de>
parents: 1274
diff changeset
   123
89497fff7f87 documentation
Claus Gittinger <cg@exept.de>
parents: 1274
diff changeset
   124
    [author:]
4445
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   125
        Claus Gittinger
12
8e03bd717355 *** empty log message ***
claus
parents: 3
diff changeset
   126
"
2174
3c6300f27f74 example section;
Claus Gittinger <cg@exept.de>
parents: 2081
diff changeset
   127
!
3c6300f27f74 example section;
Claus Gittinger <cg@exept.de>
parents: 2081
diff changeset
   128
3c6300f27f74 example section;
Claus Gittinger <cg@exept.de>
parents: 2081
diff changeset
   129
examples
3c6300f27f74 example section;
Claus Gittinger <cg@exept.de>
parents: 2081
diff changeset
   130
"
3c6300f27f74 example section;
Claus Gittinger <cg@exept.de>
parents: 2081
diff changeset
   131
    Examples on Exception-raising & handling are found in the doc/coding
3c6300f27f74 example section;
Claus Gittinger <cg@exept.de>
parents: 2081
diff changeset
   132
    section (CodingExamples).
3c6300f27f74 example section;
Claus Gittinger <cg@exept.de>
parents: 2081
diff changeset
   133
3c6300f27f74 example section;
Claus Gittinger <cg@exept.de>
parents: 2081
diff changeset
   134
    The emergencyHandler stuff is very useful, to prevent endUser applications
3c6300f27f74 example section;
Claus Gittinger <cg@exept.de>
parents: 2081
diff changeset
   135
    from entering the debugger.
3c6300f27f74 example section;
Claus Gittinger <cg@exept.de>
parents: 2081
diff changeset
   136
    Some commonly used (useful) emergency handlers are provided in the
3c6300f27f74 example section;
Claus Gittinger <cg@exept.de>
parents: 2081
diff changeset
   137
    'useful handlers' section; try them to learn more
3c6300f27f74 example section;
Claus Gittinger <cg@exept.de>
parents: 2081
diff changeset
   138
    (especially, the mailingHandler is fun).
3c6300f27f74 example section;
Claus Gittinger <cg@exept.de>
parents: 2081
diff changeset
   139
2219
Claus Gittinger <cg@exept.de>
parents: 2208
diff changeset
   140
    Of course, these are only examples - you may define your own handler
Claus Gittinger <cg@exept.de>
parents: 2208
diff changeset
   141
    block and pass it to the #emergencyHandler: method.
Claus Gittinger <cg@exept.de>
parents: 2208
diff changeset
   142
Claus Gittinger <cg@exept.de>
parents: 2208
diff changeset
   143
    BTW: the Launchers 'source & debugger' settings menu allows you
Claus Gittinger <cg@exept.de>
parents: 2208
diff changeset
   144
         to install either a default or the notifying handler.
Claus Gittinger <cg@exept.de>
parents: 2208
diff changeset
   145
Claus Gittinger <cg@exept.de>
parents: 2208
diff changeset
   146
Claus Gittinger <cg@exept.de>
parents: 2208
diff changeset
   147
    A handler which shows a box, then aborts - (no more debuggers):
Claus Gittinger <cg@exept.de>
parents: 2208
diff changeset
   148
                                                                [exBegin]
Claus Gittinger <cg@exept.de>
parents: 2208
diff changeset
   149
        Exception emergencyHandler:(Exception abortingEmergencyHandler)
Claus Gittinger <cg@exept.de>
parents: 2208
diff changeset
   150
                                                                [exEnd]
Claus Gittinger <cg@exept.de>
parents: 2208
diff changeset
   151
Claus Gittinger <cg@exept.de>
parents: 2208
diff changeset
   152
Claus Gittinger <cg@exept.de>
parents: 2208
diff changeset
   153
    A handler which aborts - (no box, no debugger):
Claus Gittinger <cg@exept.de>
parents: 2208
diff changeset
   154
                                                                [exBegin]
Claus Gittinger <cg@exept.de>
parents: 2208
diff changeset
   155
        Exception emergencyHandler:[:ex | AbortSignal raise]
Claus Gittinger <cg@exept.de>
parents: 2208
diff changeset
   156
                                                                [exEnd]
2174
3c6300f27f74 example section;
Claus Gittinger <cg@exept.de>
parents: 2081
diff changeset
   157
3c6300f27f74 example section;
Claus Gittinger <cg@exept.de>
parents: 2081
diff changeset
   158
3c6300f27f74 example section;
Claus Gittinger <cg@exept.de>
parents: 2081
diff changeset
   159
    try some exception (for demonstration, in some other process):
2219
Claus Gittinger <cg@exept.de>
parents: 2208
diff changeset
   160
                                                                [exBegin]
Claus Gittinger <cg@exept.de>
parents: 2208
diff changeset
   161
        [
Claus Gittinger <cg@exept.de>
parents: 2208
diff changeset
   162
            #(1 2 3) at:4
Claus Gittinger <cg@exept.de>
parents: 2208
diff changeset
   163
        ] fork.
Claus Gittinger <cg@exept.de>
parents: 2208
diff changeset
   164
                                                                [exEnd]
2174
3c6300f27f74 example section;
Claus Gittinger <cg@exept.de>
parents: 2081
diff changeset
   165
2219
Claus Gittinger <cg@exept.de>
parents: 2208
diff changeset
   166
    cleanup (switch back to the regular handler, which enters the debugger):
Claus Gittinger <cg@exept.de>
parents: 2208
diff changeset
   167
                                                                [exBegin]
Claus Gittinger <cg@exept.de>
parents: 2208
diff changeset
   168
        Exception emergencyHandler:nil
Claus Gittinger <cg@exept.de>
parents: 2208
diff changeset
   169
                                                                [exEnd]
Claus Gittinger <cg@exept.de>
parents: 2208
diff changeset
   170
Claus Gittinger <cg@exept.de>
parents: 2208
diff changeset
   171
Claus Gittinger <cg@exept.de>
parents: 2208
diff changeset
   172
    A handler which shows a warnBox and asks for debugging:
Claus Gittinger <cg@exept.de>
parents: 2208
diff changeset
   173
                                                                [exBegin]
Claus Gittinger <cg@exept.de>
parents: 2208
diff changeset
   174
        Exception emergencyHandler:(Exception notifyingEmergencyHandler)
Claus Gittinger <cg@exept.de>
parents: 2208
diff changeset
   175
                                                                [exEnd]
Claus Gittinger <cg@exept.de>
parents: 2208
diff changeset
   176
2174
3c6300f27f74 example section;
Claus Gittinger <cg@exept.de>
parents: 2081
diff changeset
   177
3c6300f27f74 example section;
Claus Gittinger <cg@exept.de>
parents: 2081
diff changeset
   178
3c6300f27f74 example section;
Claus Gittinger <cg@exept.de>
parents: 2081
diff changeset
   179
    A handler which dumps information to a file (watch the file 'errorTrace.stx'):
2219
Claus Gittinger <cg@exept.de>
parents: 2208
diff changeset
   180
                                                                [exBegin]
Claus Gittinger <cg@exept.de>
parents: 2208
diff changeset
   181
        Exception emergencyHandler:(Exception dumpingEmergencyHandler)
Claus Gittinger <cg@exept.de>
parents: 2208
diff changeset
   182
                                                                [exEnd]
Claus Gittinger <cg@exept.de>
parents: 2208
diff changeset
   183
Claus Gittinger <cg@exept.de>
parents: 2208
diff changeset
   184
2174
3c6300f27f74 example section;
Claus Gittinger <cg@exept.de>
parents: 2081
diff changeset
   185
3c6300f27f74 example section;
Claus Gittinger <cg@exept.de>
parents: 2081
diff changeset
   186
    A handler which sends you mail:
2219
Claus Gittinger <cg@exept.de>
parents: 2208
diff changeset
   187
                                                                [exBegin]
Claus Gittinger <cg@exept.de>
parents: 2208
diff changeset
   188
        Exception emergencyHandler:(Exception mailingEmergencyHandler)
Claus Gittinger <cg@exept.de>
parents: 2208
diff changeset
   189
                                                                [exEnd]
2174
3c6300f27f74 example section;
Claus Gittinger <cg@exept.de>
parents: 2081
diff changeset
   190
"
12
8e03bd717355 *** empty log message ***
claus
parents: 3
diff changeset
   191
! !
3
24d81bf47225 *** empty log message ***
claus
parents: 1
diff changeset
   192
1953
c8a3af54acb3 unhandled querySignals should return nil
Claus Gittinger <cg@exept.de>
parents: 1710
diff changeset
   193
!Exception class methodsFor:'initialization'!
171
129f0e2e23df handling now in Exception
claus
parents: 142
diff changeset
   194
129f0e2e23df handling now in Exception
claus
parents: 142
diff changeset
   195
initialize 
129f0e2e23df handling now in Exception
claus
parents: 142
diff changeset
   196
    "setup the signal used to handle unhandled signals"
129f0e2e23df handling now in Exception
claus
parents: 142
diff changeset
   197
129f0e2e23df handling now in Exception
claus
parents: 142
diff changeset
   198
    RecursiveExceptionSignal isNil ifTrue:[
302
1f76060d58a4 *** empty log message ***
claus
parents: 255
diff changeset
   199
	RecursiveExceptionSignal := ErrorSignal newSignalMayProceed:false.
171
129f0e2e23df handling now in Exception
claus
parents: 142
diff changeset
   200
	RecursiveExceptionSignal nameClass:self message:#recursiveExceptionSignal.
129f0e2e23df handling now in Exception
claus
parents: 142
diff changeset
   201
	RecursiveExceptionSignal notifierString:'recursive signal raise in handler'
129f0e2e23df handling now in Exception
claus
parents: 142
diff changeset
   202
    ]
129f0e2e23df handling now in Exception
claus
parents: 142
diff changeset
   203
! !
129f0e2e23df handling now in Exception
claus
parents: 142
diff changeset
   204
1953
c8a3af54acb3 unhandled querySignals should return nil
Claus Gittinger <cg@exept.de>
parents: 1710
diff changeset
   205
!Exception class methodsFor:'instance creation'!
621
87602c9d071c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 547
diff changeset
   206
4441
018f14253f8a checkin from browser
Stefan Vogel <sv@exept.de>
parents: 4439
diff changeset
   207
signal:aSignal originator:origin
018f14253f8a checkin from browser
Stefan Vogel <sv@exept.de>
parents: 4439
diff changeset
   208
    "create a new instance and set the fields in preparation for a raise.
018f14253f8a checkin from browser
Stefan Vogel <sv@exept.de>
parents: 4439
diff changeset
   209
     - only to be sent from the signal when raising"
018f14253f8a checkin from browser
Stefan Vogel <sv@exept.de>
parents: 4439
diff changeset
   210
018f14253f8a checkin from browser
Stefan Vogel <sv@exept.de>
parents: 4439
diff changeset
   211
    "{ Pragma: +inlineNew }"
018f14253f8a checkin from browser
Stefan Vogel <sv@exept.de>
parents: 4439
diff changeset
   212
018f14253f8a checkin from browser
Stefan Vogel <sv@exept.de>
parents: 4439
diff changeset
   213
    ^ (self basicNew) signal:aSignal originator:origin.
018f14253f8a checkin from browser
Stefan Vogel <sv@exept.de>
parents: 4439
diff changeset
   214
018f14253f8a checkin from browser
Stefan Vogel <sv@exept.de>
parents: 4439
diff changeset
   215
    "Created: / 23.7.1999 / 13:40:45 / stefan"
018f14253f8a checkin from browser
Stefan Vogel <sv@exept.de>
parents: 4439
diff changeset
   216
!
018f14253f8a checkin from browser
Stefan Vogel <sv@exept.de>
parents: 4439
diff changeset
   217
621
87602c9d071c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 547
diff changeset
   218
signal:aSignal parameter:aParameter errorString:aString suspendedContext:sContext originator:origin
87602c9d071c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 547
diff changeset
   219
    "create a new instance and set the fields in preparation for a raise.
87602c9d071c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 547
diff changeset
   220
     - only to be sent from the signal when raising"
87602c9d071c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 547
diff changeset
   221
3091
eca3dfaa92c9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3068
diff changeset
   222
    "{ Pragma: +inlineNew }"
eca3dfaa92c9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3068
diff changeset
   223
3017
cdd87208ae2f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3011
diff changeset
   224
    ^ (self basicNew)
621
87602c9d071c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 547
diff changeset
   225
	signal:aSignal 
87602c9d071c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 547
diff changeset
   226
	parameter:aParameter 
87602c9d071c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 547
diff changeset
   227
	errorString:aString 
87602c9d071c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 547
diff changeset
   228
	suspendedContext:sContext 
87602c9d071c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 547
diff changeset
   229
	originator:origin.
87602c9d071c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 547
diff changeset
   230
! !
87602c9d071c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 547
diff changeset
   231
1953
c8a3af54acb3 unhandled querySignals should return nil
Claus Gittinger <cg@exept.de>
parents: 1710
diff changeset
   232
!Exception class methodsFor:'Signal constants'!
171
129f0e2e23df handling now in Exception
claus
parents: 142
diff changeset
   233
129f0e2e23df handling now in Exception
claus
parents: 142
diff changeset
   234
recursiveExceptionSignal
129f0e2e23df handling now in Exception
claus
parents: 142
diff changeset
   235
    "return the signal used to handle recursive signals in the handlers"
129f0e2e23df handling now in Exception
claus
parents: 142
diff changeset
   236
129f0e2e23df handling now in Exception
claus
parents: 142
diff changeset
   237
    ^ RecursiveExceptionSignal
129f0e2e23df handling now in Exception
claus
parents: 142
diff changeset
   238
! !
129f0e2e23df handling now in Exception
claus
parents: 142
diff changeset
   239
4445
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   240
!Exception class methodsFor:'compatibility - accessing'!
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   241
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   242
errorString
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   243
    "return the notifier string.
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   244
     If the notifier string starts with space, prepend
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   245
     the parents notifier string"
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   246
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   247
    NotifierString isNil ifTrue:[
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   248
        ^ self parent errorString
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   249
    ] ifFalse:[
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   250
        (NotifierString size > 0 
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   251
         and:[NotifierString first == (Character space)]) ifTrue:[
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   252
            ^ self parent errorString, NotifierString
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   253
        ] ifFalse:[
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   254
            ^ NotifierString
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   255
        ].
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   256
    ]
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   257
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   258
    "
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   259
      Object errorSignal errorString
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   260
    "
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   261
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   262
    "Created: / 23.7.1999 / 14:22:25 / stefan"
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   263
!
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   264
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   265
errorStringExtra:extraString with:aParameter
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   266
    "used when raising with a given error string and/or parameter; 
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   267
     if the errorString starts with a space, it is appended to the receivers
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   268
     notifier string; if it ends with a space, it is prepended.
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   269
     Otherwise, the extraString is returned.
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   270
     If no extraString is given, use the signals default errorString."
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   271
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   272
    |t|
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   273
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   274
    (self inheritsFrom:Object userNotificationSignal) ifTrue:[
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   275
        "/ all userNotifications pass the extraString unchanged.
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   276
        ^ extraString
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   277
    ].
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   278
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   279
    extraString isNil ifTrue:[
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   280
        t := self errorString
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   281
    ] ifFalse:[
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   282
        t := extraString.
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   283
        (extraString endsWith:Character space) ifTrue:[
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   284
            t := extraString, self errorString
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   285
        ] ifFalse:[
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   286
            (extraString startsWith:Character space) ifTrue:[
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   287
                t := self errorString, extraString
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   288
            ]
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   289
        ].
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   290
    ].
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   291
    ^ t.
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   292
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   293
"/    aParameter isNil ifTrue:[
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   294
"/        ^ t
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   295
"/    ].
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   296
"/
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   297
"/    (t startsWith:' ') ifTrue:[
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   298
"/        ^ aParameter printString , t
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   299
"/    ].
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   300
"/    (t endsWith:' ') ifTrue:[
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   301
"/        ^ t , aParameter printString
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   302
"/    ].
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   303
"/    ^ t
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   304
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   305
    "Modified: / 25.3.1997 / 12:12:37 / cg"
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   306
    "Created: / 23.7.1999 / 14:23:38 / stefan"
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   307
!
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   308
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   309
handlerBlock
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   310
    "Compatibility with Signal. Class based exeption do not have a handler
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   311
     block. They redefine the #action method instead"
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   312
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   313
    ^ nil
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   314
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   315
    "Created: / 23.7.1999 / 14:43:18 / stefan"
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   316
! !
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   317
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   318
!Exception class methodsFor:'compatibility - queries'!
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   319
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   320
accepts:aSignal
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   321
    "return true, if the receiver accepts the argument, aSignal.
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   322
     (i.e. the receiver is aSignal or a parent of it). False otherwise."
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   323
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   324
    |s|
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   325
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   326
    aSignal isQuerySignal ifTrue:[^ false].
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   327
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   328
    s := aSignal.
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   329
    [s notNil] whileTrue:[
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   330
        self == s ifTrue:[^ true].
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   331
        s := s parent
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   332
    ].
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   333
    ^ false
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   334
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   335
    "Created: / 23.7.1999 / 14:00:47 / stefan"
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   336
!
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   337
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   338
inheritsFrom:anotherSignal
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   339
    "return true, if the receiver is a child of anotherSignal
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   340
     (i.e. if handling anotherSignal also handles the receiver)
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   341
     This is almost the same as accepts, but returns false, if
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   342
     the receiver is identical to anotherSignal."
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   343
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   344
    self == anotherSignal ifTrue:[^ false].
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   345
    ^ anotherSignal accepts:self
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   346
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   347
    "Created: / 23.7.1999 / 13:59:51 / stefan"
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   348
!
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   349
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   350
isHandled
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   351
    "return true, if there is a handler for the receiver signal.
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   352
     Raising an unhandled signal will usually lead into the debugger,
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   353
     but can be caught globally by setting Exceptions EmergencyHandler."
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   354
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   355
    ^ self isHandledIn:(thisContext sender).
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   356
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   357
    "Created: / 23.7.1999 / 14:03:50 / stefan"
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   358
!
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   359
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   360
isHandledIn:aContext
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   361
    "return true, if there is a handler for the receiver signal in the 
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   362
     contextChain starting with aContext."
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   363
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   364
    |con r|
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   365
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   366
    con := aContext.
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   367
    [con notNil] whileTrue:[
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   368
        con := con findNextContextWithSelector:#'handle:do:' or:#'handle:from:do:' or:nil.
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   369
        con notNil ifTrue:[
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   370
            "
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   371
             is this is a #handle:do: or a #handle:from:do: context
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   372
             with self in it ?
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   373
            "
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   374
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   375
            ((r := con receiver) notNil
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   376
            and:[r accepts:self]) ifTrue:[
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   377
                "found a handler context"
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   378
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   379
                ^ true
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   380
            ]
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   381
        ]
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   382
    ].
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   383
    ^ false
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   384
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   385
    "Created: / 23.7.1999 / 14:03:34 / stefan"
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   386
!
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   387
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   388
isQuerySignal
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   389
    "return true, if this is a querySignal - always return false here"
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   390
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   391
    ^ false
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   392
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   393
    "Created: / 23.7.1999 / 13:50:16 / stefan"
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   394
!
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   395
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   396
isSignal
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   397
    "return true, if the receiver is some kind of signal;
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   398
     true returned here - the method is redefined from Object."
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   399
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   400
    ^ true
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   401
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   402
    "Created: / 23.7.1999 / 13:49:59 / stefan"
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   403
!
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   404
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   405
mayProceed
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   406
    "return true, if the exception handler is allowed to proceed
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   407
     the execution where the exception occured.
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   408
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   409
     Subclasses may redefine this."
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   410
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   411
    ^ true
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   412
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   413
    "Modified: / 23.7.1999 / 14:50:11 / stefan"
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   414
!
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   415
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   416
parent
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   417
    "return the parent Signal/Exception of myself.
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   418
     Subclasses may redefine this to install themself as child of
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   419
     existing Signals."
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   420
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   421
    self == Exception ifTrue:[
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   422
        ^ nil
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   423
    ].
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   424
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   425
    ^ superclass
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   426
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   427
    "Created: / 23.7.1999 / 14:01:29 / stefan"
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   428
    "Modified: / 23.7.1999 / 16:15:38 / stefan"
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   429
! !
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   430
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   431
!Exception class methodsFor:'compatibility - raising'!
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   432
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   433
newException
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   434
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   435
    ^ self new signal:self.
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   436
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   437
    "Created: / 23.7.1999 / 13:45:49 / stefan"
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   438
    "Modified: / 23.7.1999 / 13:53:12 / stefan"
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   439
!
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   440
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   441
newExceptionFrom:originator
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   442
    "answer a new exception object for this signal.
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   443
     Set the originator.
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   444
     Subclasses may redefine this method"
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   445
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   446
    ^ self new originator:originator
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   447
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   448
    "Created: / 23.7.1999 / 13:47:07 / stefan"
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   449
!
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   450
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   451
raise
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   452
    "raise a signal nonproceedable.
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   453
     The signals notifierString is used as errorString."
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   454
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   455
    ^ self newException raise
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   456
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   457
    "Modified: / 2.5.1996 / 16:36:23 / cg"
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   458
    "Modified: / 5.3.1998 / 16:44:36 / stefan"
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   459
    "Created: / 23.7.1999 / 14:07:17 / stefan"
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   460
!
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   461
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   462
raiseErrorString:aString
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   463
    "raise a signal nonproceedable.
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   464
     The argument is used as errorString."
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   465
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   466
    ^ (self newException errorString:aString) raise.
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   467
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   468
    "Modified: / 9.5.1996 / 15:17:59 / cg"
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   469
    "Modified: / 12.3.1998 / 15:15:22 / stefan"
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   470
    "Created: / 23.7.1999 / 14:07:33 / stefan"
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   471
!
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   472
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   473
raiseErrorString:aString in:aContext
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   474
    "raise a signal nonproceedable.
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   475
     The argument is used as errorString.
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   476
     The additional context is passed as the context responsible for the raise,
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   477
     allowing a raise to mimicri the exception happened somewhere else."
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   478
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   479
    ^ (self newException   
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   480
              signal:self
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   481
              parameter:nil 
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   482
              errorString:aString
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   483
              suspendedContext:aContext
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   484
              originator:nil) raise.
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   485
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   486
    "Modified: / 26.7.1996 / 16:42:47 / cg"
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   487
    "Modified: / 12.3.1998 / 15:43:43 / stefan"
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   488
    "Created: / 23.7.1999 / 14:07:48 / stefan"
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   489
!
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   490
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   491
raiseFrom:something
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   492
    "raise a signal nonproceedable.
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   493
     The argument, something is passed both as parameter and originator."
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   494
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   495
    ^ ((self newExceptionFrom:something) parameter:something) raise
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   496
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   497
    "Modified: / 2.5.1996 / 16:36:38 / cg"
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   498
    "Modified: / 5.3.1998 / 16:49:55 / stefan"
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   499
    "Created: / 23.7.1999 / 14:07:59 / stefan"
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   500
!
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   501
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   502
raiseIn:aContext
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   503
    "raise a signal nonproceedable.
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   504
     The signals notifierString is used as errorString.
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   505
     The additional context is passed as the context responsible for the raise,
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   506
     allowing a raise to mimicri the exception happened somewhere else."
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   507
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   508
    ^ (self newException suspendedContext:aContext) raise.
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   509
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   510
    "Modified: / 2.5.1996 / 16:36:44 / cg"
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   511
    "Modified: / 5.3.1998 / 16:50:21 / stefan"
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   512
    "Created: / 23.7.1999 / 14:08:13 / stefan"
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   513
!
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   514
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   515
raiseRequest
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   516
    "raise a signal proceedable.
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   517
     The signals notifierString is used as errorString."
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   518
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   519
    ^ self newException raiseRequest.
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   520
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   521
    "Modified: / 2.5.1996 / 16:36:52 / cg"
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   522
    "Modified: / 5.3.1998 / 16:50:46 / stefan"
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   523
    "Created: / 23.7.1999 / 14:08:24 / stefan"
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   524
!
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   525
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   526
raiseRequestFrom:something
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   527
    "raise a signal proceedable.
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   528
     The argument, something is passed both as parameter and originator."
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   529
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   530
    ^ ((self newExceptionFrom:something) parameter:something) raiseRequest.
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   531
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   532
    "Modified: / 2.5.1996 / 16:36:38 / cg"
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   533
    "Modified: / 5.3.1998 / 16:52:46 / stefan"
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   534
    "Created: / 23.7.1999 / 14:08:36 / stefan"
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   535
!
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   536
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   537
raiseRequestWith:aParameter
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   538
    "raise a signal proceedable.
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   539
     The signals notifierString is used as errorString."
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   540
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   541
    ^ (self newException parameter:aParameter) raiseRequest.
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   542
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   543
    "Modified: / 9.5.1996 / 15:13:20 / cg"
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   544
    "Modified: / 12.3.1998 / 15:16:57 / stefan"
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   545
    "Created: / 23.7.1999 / 14:08:48 / stefan"
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   546
!
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   547
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   548
raiseRequestWith:aParameter errorString:aString
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   549
    "raise a signal proceedable.
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   550
     The argument, aString is used as errorString."
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   551
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   552
    ^ (self newException 
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   553
              parameter:aParameter; 
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   554
              errorString:aString
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   555
      ) raiseRequest
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   556
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   557
    "Modified: / 9.5.1996 / 15:13:35 / cg"
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   558
    "Modified: / 12.3.1998 / 15:17:52 / stefan"
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   559
    "Created: / 23.7.1999 / 14:08:57 / stefan"
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   560
!
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   561
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   562
raiseRequestWith:aParameter errorString:aString in:aContext
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   563
    "raise a signal proceedable.
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   564
     The argument, aString is used as errorString.
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   565
     The additional context is passed as the context responsible for the raise,
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   566
     allowing a raise to mimicri the exception happened somewhere else."
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   567
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   568
    ^ (self newException 
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   569
              parameter:aParameter; 
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   570
              errorString:aString;
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   571
              suspendedContext:aContext) raiseRequest
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   572
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   573
    "Modified: / 26.7.1996 / 16:29:27 / cg"
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   574
    "Modified: / 12.3.1998 / 15:18:34 / stefan"
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   575
    "Created: / 23.7.1999 / 14:09:07 / stefan"
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   576
!
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   577
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   578
raiseRequestWith:aParameter in:aContext
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   579
    "raise a signal proceedable.
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   580
     The signals notifierString is used as errorString.
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   581
     The additional context is passed as the context responsible for the raise,
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   582
     allowing a raise to mimicri the exception happened somewhere else."
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   583
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   584
    ^ (self newException 
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   585
              parameter:aParameter; 
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   586
              suspendedContext:aContext) raiseRequest.
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   587
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   588
    "Modified: / 26.7.1996 / 16:29:33 / cg"
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   589
    "Modified: / 12.3.1998 / 15:18:55 / stefan"
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   590
    "Created: / 23.7.1999 / 14:09:17 / stefan"
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   591
!
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   592
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   593
raiseWith:aParameter
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   594
    "raise a signal nonproceedable.
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   595
     The argument, aParameter is passed as parameter."
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   596
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   597
    ^ (self newException parameter:aParameter) raise.
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   598
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   599
    "Modified: / 9.5.1996 / 15:14:24 / cg"
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   600
    "Modified: / 12.3.1998 / 15:19:11 / stefan"
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   601
    "Created: / 23.7.1999 / 14:09:27 / stefan"
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   602
!
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   603
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   604
raiseWith:aParameter errorString:aString
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   605
    "raise a signal nonproceedable.
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   606
     The argument, aString is used as errorString, aParameter is passed
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   607
     as exception parameter."
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   608
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   609
    ^ (self newException 
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   610
              parameter:aParameter;
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   611
              errorString:aString) raise.
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   612
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   613
    "Modified: / 9.5.1996 / 15:14:32 / cg"
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   614
    "Modified: / 12.3.1998 / 15:19:40 / stefan"
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   615
    "Created: / 23.7.1999 / 14:09:36 / stefan"
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   616
!
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   617
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   618
raiseWith:aParameter errorString:aString in:aContext
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   619
    "raise a signal nonproceedable.
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   620
     The argument, aString is used as errorString, aParameter is passed
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   621
     as exception parameter.
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   622
     The additional context is passed as the context responsible for the raise,
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   623
     allowing a raise to mimicri the exception happened somewhere else."
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   624
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   625
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   626
    ^ (self newException 
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   627
              parameter:aParameter; 
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   628
              errorString:aString;
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   629
              suspendedContext:aContext) raise.
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   630
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   631
    "Modified: / 26.7.1996 / 16:29:42 / cg"
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   632
    "Modified: / 12.3.1998 / 15:20:12 / stefan"
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   633
    "Created: / 23.7.1999 / 14:09:46 / stefan"
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   634
!
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   635
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   636
raiseWith:aParameter in:aContext
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   637
    "raise a signal nonproceedable.
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   638
     The argument, aParameter is passed as parameter."
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   639
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   640
    ^ (self newException parameter:aParameter;
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   641
                         suspendedContext:aContext) raise.
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   642
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   643
    "Modified: / 9.5.1996 / 15:14:24 / cg"
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   644
    "Modified: / 12.3.1998 / 15:34:51 / stefan"
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   645
    "Created: / 23.7.1999 / 14:10:04 / stefan"
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   646
! !
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   647
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   648
!Exception class methodsFor:'compatibility - save evaluation'!
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   649
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   650
catch:aBlock
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   651
     "evaluate the argument, aBlock.
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   652
      If the receiver-signal is raised during evaluation, abort
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   653
      the evaluation and return true; otherwise return false. 
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   654
      This is the catch & throw mechanism found in other languages,
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   655
      where the returned value indicates if an exception occured."
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   656
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   657
      |raiseOccurred|
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   658
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   659
      raiseOccurred := false.
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   660
      self handle:[:ex | raiseOccurred := true. ex return] do:aBlock.
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   661
      ^ raiseOccurred
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   662
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   663
      "
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   664
       Object messageNotUnderstoodSignal catch:[
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   665
          123 size open   
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   666
       ]
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   667
      "
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   668
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   669
    "Created: / 23.7.1999 / 14:06:01 / stefan"
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   670
!
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   671
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   672
handle:handleBlock do:aBlock
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   673
    "evaluate the argument, aBlock.
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   674
     If the receiver-signal is raised during evaluation,
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   675
     evaluate the handleBlock passing it an Exception argument.
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   676
     The handler may decide how to react to the signal by sending
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   677
     a corresponding message to the exception (see there).
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   678
     If the signal is not raised, return the value of evaluating
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   679
     aBlock."
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   680
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   681
     ^ aBlock value  "the real logic is in Exception>>doRaise"
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   682
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   683
      "
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   684
       Object messageNotUnderstoodSignal handle:[:ex |
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   685
          'oops' printNL.
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   686
          ex return
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   687
       ] do:[
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   688
          123 size open   
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   689
       ]
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   690
      "
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   691
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   692
      "
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   693
       |num|
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   694
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   695
       num := 0.
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   696
       Number divisionByZeroSignal handle:[:ex |
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   697
          'oops' printNL.
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   698
          ex return
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   699
       ] do:[
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   700
          123 / num   
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   701
       ]
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   702
      "
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   703
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   704
    "Modified: / 2.3.1998 / 14:28:26 / stefan"
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   705
    "Created: / 23.7.1999 / 14:06:13 / stefan"
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   706
!
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   707
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   708
handle:handleBlock from:anObject do:aBlock
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   709
    "evaluate the argument, aBlock.
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   710
     If the receiver-signal is raised during evaluation,
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   711
     and the exception originated from anObject,
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   712
     evaluate the handleBlock passing it an Exception argument.
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   713
     The handler may decide how to react to the signal by sending
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   714
     a corresponding message to the exception (see there).
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   715
     If the signal is not raised, return the value of evaluating
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   716
     aBlock."
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   717
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   718
     ^ aBlock value  "the real logic is in Exception>>doRaise"
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   719
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   720
      "
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   721
       the first open will be caught; the second not:
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   722
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   723
       |o1 o2|
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   724
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   725
       o1 := 123.
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   726
       o2 := nil.
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   727
       Object messageNotUnderstoodSignal 
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   728
           handle:
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   729
                [:ex |
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   730
                    'oops' printNL.
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   731
                    ex proceed
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   732
                ] 
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   733
           from:o1
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   734
           do:
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   735
                [
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   736
                    o1 open.
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   737
                    o2 open
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   738
                ]
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   739
      "
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   740
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   741
    "Modified: / 2.3.1998 / 14:28:05 / stefan"
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   742
    "Created: / 23.7.1999 / 14:06:26 / stefan"
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   743
!
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   744
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   745
ignoreIn:aBlock
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   746
     "evaluate the argument, aBlock.
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   747
      Ignore the receiver-signal during evaluation - i.e. simply
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   748
      continue. 
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   749
      This makes only sense for some signals, such as UserInterrupt
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   750
      or AbortSignal, because continuing after an exception without any cleanup
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   751
      often leads to followup-errors."
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   752
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   753
      ^ self handle:[:ex | ex proceed] do:aBlock.
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   754
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   755
      "
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   756
       Object messageNotUnderstoodSignal ignoreIn:[
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   757
          123 size open   
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   758
       ]
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   759
      "
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   760
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   761
    "Created: / 23.7.1999 / 14:06:40 / stefan"
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   762
! !
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   763
4447
b41133d7941b Add signal creation methods.
Stefan Vogel <sv@exept.de>
parents: 4445
diff changeset
   764
!Exception class methodsFor:'compatibility - signal creation'!
b41133d7941b Add signal creation methods.
Stefan Vogel <sv@exept.de>
parents: 4445
diff changeset
   765
b41133d7941b Add signal creation methods.
Stefan Vogel <sv@exept.de>
parents: 4445
diff changeset
   766
newSignal
b41133d7941b Add signal creation methods.
Stefan Vogel <sv@exept.de>
parents: 4445
diff changeset
   767
    "create a new signal, using the receiver as a prototype and
b41133d7941b Add signal creation methods.
Stefan Vogel <sv@exept.de>
parents: 4445
diff changeset
   768
     setting the parent of the new signal to the receiver."
b41133d7941b Add signal creation methods.
Stefan Vogel <sv@exept.de>
parents: 4445
diff changeset
   769
b41133d7941b Add signal creation methods.
Stefan Vogel <sv@exept.de>
parents: 4445
diff changeset
   770
    ^ self newSignalMayProceed:self mayProceed
b41133d7941b Add signal creation methods.
Stefan Vogel <sv@exept.de>
parents: 4445
diff changeset
   771
b41133d7941b Add signal creation methods.
Stefan Vogel <sv@exept.de>
parents: 4445
diff changeset
   772
    "Created: / 23.7.1999 / 20:13:23 / stefan"
b41133d7941b Add signal creation methods.
Stefan Vogel <sv@exept.de>
parents: 4445
diff changeset
   773
!
b41133d7941b Add signal creation methods.
Stefan Vogel <sv@exept.de>
parents: 4445
diff changeset
   774
b41133d7941b Add signal creation methods.
Stefan Vogel <sv@exept.de>
parents: 4445
diff changeset
   775
newSignalMayProceed:proceed
b41133d7941b Add signal creation methods.
Stefan Vogel <sv@exept.de>
parents: 4445
diff changeset
   776
    "create a new signal, using the receiver as a prototype and
b41133d7941b Add signal creation methods.
Stefan Vogel <sv@exept.de>
parents: 4445
diff changeset
   777
     setting the parent of the new signal to the receiver."
b41133d7941b Add signal creation methods.
Stefan Vogel <sv@exept.de>
parents: 4445
diff changeset
   778
b41133d7941b Add signal creation methods.
Stefan Vogel <sv@exept.de>
parents: 4445
diff changeset
   779
    ^ (Signal basicNew) mayProceed:proceed;
b41133d7941b Add signal creation methods.
Stefan Vogel <sv@exept.de>
parents: 4445
diff changeset
   780
                    notifierString:NotifierString;
b41133d7941b Add signal creation methods.
Stefan Vogel <sv@exept.de>
parents: 4445
diff changeset
   781
                            parent:self
b41133d7941b Add signal creation methods.
Stefan Vogel <sv@exept.de>
parents: 4445
diff changeset
   782
b41133d7941b Add signal creation methods.
Stefan Vogel <sv@exept.de>
parents: 4445
diff changeset
   783
    "Created: / 23.7.1999 / 20:12:43 / stefan"
b41133d7941b Add signal creation methods.
Stefan Vogel <sv@exept.de>
parents: 4445
diff changeset
   784
! !
b41133d7941b Add signal creation methods.
Stefan Vogel <sv@exept.de>
parents: 4445
diff changeset
   785
1953
c8a3af54acb3 unhandled querySignals should return nil
Claus Gittinger <cg@exept.de>
parents: 1710
diff changeset
   786
!Exception class methodsFor:'defaults'!
12
8e03bd717355 *** empty log message ***
claus
parents: 3
diff changeset
   787
8e03bd717355 *** empty log message ***
claus
parents: 3
diff changeset
   788
emergencyHandler
2174
3c6300f27f74 example section;
Claus Gittinger <cg@exept.de>
parents: 2081
diff changeset
   789
    "return the handler used for unhandled exceptions.
3c6300f27f74 example section;
Claus Gittinger <cg@exept.de>
parents: 2081
diff changeset
   790
3c6300f27f74 example section;
Claus Gittinger <cg@exept.de>
parents: 2081
diff changeset
   791
     If no EmergencyHandler has been set, a handler which enters the 
3c6300f27f74 example section;
Claus Gittinger <cg@exept.de>
parents: 2081
diff changeset
   792
     debugger is returned.
3c6300f27f74 example section;
Claus Gittinger <cg@exept.de>
parents: 2081
diff changeset
   793
     The debugger is opened by asking the signal for a debug action,
3c6300f27f74 example section;
Claus Gittinger <cg@exept.de>
parents: 2081
diff changeset
   794
     this allows to provide other debuggers in specialized (subclass-instances)
3c6300f27f74 example section;
Claus Gittinger <cg@exept.de>
parents: 2081
diff changeset
   795
     of Signal (if that is ever needed)"
12
8e03bd717355 *** empty log message ***
claus
parents: 3
diff changeset
   796
77
6c38ca59927f *** empty log message ***
claus
parents: 68
diff changeset
   797
    "
6c38ca59927f *** empty log message ***
claus
parents: 68
diff changeset
   798
     set it up, when called the first time
6c38ca59927f *** empty log message ***
claus
parents: 68
diff changeset
   799
    "
6c38ca59927f *** empty log message ***
claus
parents: 68
diff changeset
   800
    EmergencyHandler isNil ifTrue:[
2208
cc55b9f5b47e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2204
diff changeset
   801
	EmergencyHandler := [:ex |
cc55b9f5b47e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2204
diff changeset
   802
	    "
cc55b9f5b47e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2204
diff changeset
   803
	     sending it to the signal allows per-signal specific
cc55b9f5b47e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2204
diff changeset
   804
	     debuggers to be implemented in the future
cc55b9f5b47e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2204
diff changeset
   805
	     (for example, segv in primitive code could show things 
cc55b9f5b47e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2204
diff changeset
   806
	      on the C-level ..)
cc55b9f5b47e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2204
diff changeset
   807
	    "
cc55b9f5b47e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2204
diff changeset
   808
	    (ex signal) enterDebuggerWith:ex message:(ex errorString).
cc55b9f5b47e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2204
diff changeset
   809
	]
77
6c38ca59927f *** empty log message ***
claus
parents: 68
diff changeset
   810
    ].
6c38ca59927f *** empty log message ***
claus
parents: 68
diff changeset
   811
12
8e03bd717355 *** empty log message ***
claus
parents: 3
diff changeset
   812
    ^ EmergencyHandler
2174
3c6300f27f74 example section;
Claus Gittinger <cg@exept.de>
parents: 2081
diff changeset
   813
3c6300f27f74 example section;
Claus Gittinger <cg@exept.de>
parents: 2081
diff changeset
   814
    "Modified: 15.1.1997 / 20:50:37 / cg"
12
8e03bd717355 *** empty log message ***
claus
parents: 3
diff changeset
   815
!
8e03bd717355 *** empty log message ***
claus
parents: 3
diff changeset
   816
130
e09411db2573 emergencyhandler is now a one-arg-block
claus
parents: 92
diff changeset
   817
emergencyHandler:aOneArgBlock
2174
3c6300f27f74 example section;
Claus Gittinger <cg@exept.de>
parents: 2081
diff changeset
   818
    "set the handler used for unhandled exceptions.
3c6300f27f74 example section;
Claus Gittinger <cg@exept.de>
parents: 2081
diff changeset
   819
     The default (a nil-handler) leads to a debugger to be shown."
12
8e03bd717355 *** empty log message ***
claus
parents: 3
diff changeset
   820
130
e09411db2573 emergencyhandler is now a one-arg-block
claus
parents: 92
diff changeset
   821
    EmergencyHandler := aOneArgBlock
362
claus
parents: 345
diff changeset
   822
claus
parents: 345
diff changeset
   823
    "ST-80 behavior of first showing a notifier:
claus
parents: 345
diff changeset
   824
     (I prefer to get right into the debugger, though)
claus
parents: 345
diff changeset
   825
claus
parents: 345
diff changeset
   826
     Exception
2208
cc55b9f5b47e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2204
diff changeset
   827
	emergencyHandler:
cc55b9f5b47e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2204
diff changeset
   828
	    [:ex | self errorNotify:ex errorString ]
2081
f16d9b47a0b0 comment
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
   829
    "
f16d9b47a0b0 comment
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
   830
f16d9b47a0b0 comment
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
   831
    "ST-X behavior of going right into the debugger:
f16d9b47a0b0 comment
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
   832
f16d9b47a0b0 comment
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
   833
     Exception
2208
cc55b9f5b47e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2204
diff changeset
   834
	emergencyHandler:nil
362
claus
parents: 345
diff changeset
   835
    "
claus
parents: 345
diff changeset
   836
claus
parents: 345
diff changeset
   837
    "automatically aborting current operation, on error:
claus
parents: 345
diff changeset
   838
     (may be useful for end-user apps; make certain, 
claus
parents: 345
diff changeset
   839
      you have abortSignal handlers at appropriate places)
claus
parents: 345
diff changeset
   840
claus
parents: 345
diff changeset
   841
     Exception
2208
cc55b9f5b47e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2204
diff changeset
   842
	emergencyHandler:
cc55b9f5b47e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2204
diff changeset
   843
	    [:ex | Object abortSignal raise. ex return. ]
362
claus
parents: 345
diff changeset
   844
    "
claus
parents: 345
diff changeset
   845
claus
parents: 345
diff changeset
   846
    "finally, traditional language system behavior; dump core ;-)
claus
parents: 345
diff changeset
   847
claus
parents: 345
diff changeset
   848
     Exception
2208
cc55b9f5b47e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2204
diff changeset
   849
	emergencyHandler:
cc55b9f5b47e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2204
diff changeset
   850
	    [:ex | Smalltalk exitWithCoreDump. ]
362
claus
parents: 345
diff changeset
   851
    "
2081
f16d9b47a0b0 comment
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
   852
2174
3c6300f27f74 example section;
Claus Gittinger <cg@exept.de>
parents: 2081
diff changeset
   853
    "Modified: 15.1.1997 / 20:49:06 / cg"
3c6300f27f74 example section;
Claus Gittinger <cg@exept.de>
parents: 2081
diff changeset
   854
! !
3c6300f27f74 example section;
Claus Gittinger <cg@exept.de>
parents: 2081
diff changeset
   855
3c6300f27f74 example section;
Claus Gittinger <cg@exept.de>
parents: 2081
diff changeset
   856
!Exception class methodsFor:'useful handlers'!
3c6300f27f74 example section;
Claus Gittinger <cg@exept.de>
parents: 2081
diff changeset
   857
3c6300f27f74 example section;
Claus Gittinger <cg@exept.de>
parents: 2081
diff changeset
   858
abortingEmergencyHandler
3c6300f27f74 example section;
Claus Gittinger <cg@exept.de>
parents: 2081
diff changeset
   859
    "return a block (usable as an emergency handler), 
3c6300f27f74 example section;
Claus Gittinger <cg@exept.de>
parents: 2081
diff changeset
   860
     which aborts after showing a warnBox.
3c6300f27f74 example section;
Claus Gittinger <cg@exept.de>
parents: 2081
diff changeset
   861
     This is useful for endUser applications"
3c6300f27f74 example section;
Claus Gittinger <cg@exept.de>
parents: 2081
diff changeset
   862
3c6300f27f74 example section;
Claus Gittinger <cg@exept.de>
parents: 2081
diff changeset
   863
    ^ [:ex | self warn:'Error: ' , ex errorString.
2208
cc55b9f5b47e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2204
diff changeset
   864
	     AbortSignal raise 
2174
3c6300f27f74 example section;
Claus Gittinger <cg@exept.de>
parents: 2081
diff changeset
   865
      ]
3c6300f27f74 example section;
Claus Gittinger <cg@exept.de>
parents: 2081
diff changeset
   866
3c6300f27f74 example section;
Claus Gittinger <cg@exept.de>
parents: 2081
diff changeset
   867
    "test with (try a few halts or CTRL-C's):
3c6300f27f74 example section;
Claus Gittinger <cg@exept.de>
parents: 2081
diff changeset
   868
     Exception emergencyHandler:(Exception abortingEmergencyHandler)
3c6300f27f74 example section;
Claus Gittinger <cg@exept.de>
parents: 2081
diff changeset
   869
    "
3c6300f27f74 example section;
Claus Gittinger <cg@exept.de>
parents: 2081
diff changeset
   870
3c6300f27f74 example section;
Claus Gittinger <cg@exept.de>
parents: 2081
diff changeset
   871
    "back with:
3c6300f27f74 example section;
Claus Gittinger <cg@exept.de>
parents: 2081
diff changeset
   872
     Exception emergencyHandler:(Exception notifyingEmergencyHandler)
3c6300f27f74 example section;
Claus Gittinger <cg@exept.de>
parents: 2081
diff changeset
   873
     Exception emergencyHandler:nil
3c6300f27f74 example section;
Claus Gittinger <cg@exept.de>
parents: 2081
diff changeset
   874
    "
3c6300f27f74 example section;
Claus Gittinger <cg@exept.de>
parents: 2081
diff changeset
   875
3c6300f27f74 example section;
Claus Gittinger <cg@exept.de>
parents: 2081
diff changeset
   876
    "Created: 15.1.1997 / 20:13:06 / cg"
3c6300f27f74 example section;
Claus Gittinger <cg@exept.de>
parents: 2081
diff changeset
   877
    "Modified: 15.1.1997 / 20:15:02 / cg"
3c6300f27f74 example section;
Claus Gittinger <cg@exept.de>
parents: 2081
diff changeset
   878
!
3c6300f27f74 example section;
Claus Gittinger <cg@exept.de>
parents: 2081
diff changeset
   879
3c6300f27f74 example section;
Claus Gittinger <cg@exept.de>
parents: 2081
diff changeset
   880
dumpingEmergencyHandler
3c6300f27f74 example section;
Claus Gittinger <cg@exept.de>
parents: 2081
diff changeset
   881
    "return a block (usable as an emergency handler), 
3c6300f27f74 example section;
Claus Gittinger <cg@exept.de>
parents: 2081
diff changeset
   882
     which dumps the stackBacktrace to a trace file and
3c6300f27f74 example section;
Claus Gittinger <cg@exept.de>
parents: 2081
diff changeset
   883
     aborts after showing a warnBox.
3c6300f27f74 example section;
Claus Gittinger <cg@exept.de>
parents: 2081
diff changeset
   884
     This is useful, for endUser application, which are still being
3c6300f27f74 example section;
Claus Gittinger <cg@exept.de>
parents: 2081
diff changeset
   885
     debugged (i.e. the programmers may have a look at the traceFile
3c6300f27f74 example section;
Claus Gittinger <cg@exept.de>
parents: 2081
diff changeset
   886
     from time to time).
3c6300f27f74 example section;
Claus Gittinger <cg@exept.de>
parents: 2081
diff changeset
   887
3c6300f27f74 example section;
Claus Gittinger <cg@exept.de>
parents: 2081
diff changeset
   888
     Notice:
2257
1d9e88f6550e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2219
diff changeset
   889
         The code below is just an example; you may want to change the
1d9e88f6550e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2219
diff changeset
   890
         name of the error-file in your application
1d9e88f6550e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2219
diff changeset
   891
         (but please: copy the code; do not modify here)"
2174
3c6300f27f74 example section;
Claus Gittinger <cg@exept.de>
parents: 2081
diff changeset
   892
3c6300f27f74 example section;
Claus Gittinger <cg@exept.de>
parents: 2081
diff changeset
   893
    ^ [:ex | 
2257
1d9e88f6550e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2219
diff changeset
   894
             |str printedException|
2174
3c6300f27f74 example section;
Claus Gittinger <cg@exept.de>
parents: 2081
diff changeset
   895
2257
1d9e88f6550e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2219
diff changeset
   896
             ex signal == Signal noHandlerSignal ifTrue:[
1d9e88f6550e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2219
diff changeset
   897
                printedException := ex parameter.
1d9e88f6550e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2219
diff changeset
   898
             ] ifFalse:[
1d9e88f6550e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2219
diff changeset
   899
                printedException := ex
1d9e88f6550e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2219
diff changeset
   900
             ].
1d9e88f6550e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2219
diff changeset
   901
1d9e88f6550e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2219
diff changeset
   902
             "/ user interruption is handled specially:
1d9e88f6550e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2219
diff changeset
   903
             "/ allow user to choose between proceeding or aborting
1d9e88f6550e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2219
diff changeset
   904
             "/ but never dump that information to the file.
2174
3c6300f27f74 example section;
Claus Gittinger <cg@exept.de>
parents: 2081
diff changeset
   905
2257
1d9e88f6550e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2219
diff changeset
   906
             printedException signal == Object userInterruptSignal ifTrue:[
1d9e88f6550e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2219
diff changeset
   907
                  (self confirm:'abort current action ?') ifTrue:[
1d9e88f6550e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2219
diff changeset
   908
                      AbortSignal raise
1d9e88f6550e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2219
diff changeset
   909
                  ].
1d9e88f6550e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2219
diff changeset
   910
                  ex proceed
1d9e88f6550e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2219
diff changeset
   911
             ].
2174
3c6300f27f74 example section;
Claus Gittinger <cg@exept.de>
parents: 2081
diff changeset
   912
2257
1d9e88f6550e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2219
diff changeset
   913
             "/
1d9e88f6550e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2219
diff changeset
   914
             "/ dump it to 'errorTrace.stx'
1d9e88f6550e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2219
diff changeset
   915
             "/
1d9e88f6550e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2219
diff changeset
   916
             str := 'errorTrace.stx' asFilename appendingWriteStream.
2174
3c6300f27f74 example section;
Claus Gittinger <cg@exept.de>
parents: 2081
diff changeset
   917
2257
1d9e88f6550e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2219
diff changeset
   918
             str nextPutLine:('******************************* '
1d9e88f6550e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2219
diff changeset
   919
                              , AbsoluteTime now printString
1d9e88f6550e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2219
diff changeset
   920
                              , ' *******************************').
1d9e88f6550e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2219
diff changeset
   921
             str cr.
2174
3c6300f27f74 example section;
Claus Gittinger <cg@exept.de>
parents: 2081
diff changeset
   922
2257
1d9e88f6550e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2219
diff changeset
   923
             str nextPutLine:('** Error: ' , printedException errorString).
1d9e88f6550e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2219
diff changeset
   924
             str nextPutLine:('** Signal: ' , printedException signal printString).
1d9e88f6550e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2219
diff changeset
   925
             str nextPutLine:('** Parameter: ' , printedException parameter printString).
1d9e88f6550e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2219
diff changeset
   926
             str nextPutLine:('** Process: ' , Processor activeProcess printString).
1d9e88f6550e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2219
diff changeset
   927
             str nextPutLine:('** Backtrace:').
1d9e88f6550e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2219
diff changeset
   928
             str cr.
2174
3c6300f27f74 example section;
Claus Gittinger <cg@exept.de>
parents: 2081
diff changeset
   929
        
2257
1d9e88f6550e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2219
diff changeset
   930
             printedException suspendedContext fullPrintAllOn:str.
1d9e88f6550e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2219
diff changeset
   931
             str cr.
1d9e88f6550e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2219
diff changeset
   932
             str cr.
1d9e88f6550e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2219
diff changeset
   933
             str close.
2174
3c6300f27f74 example section;
Claus Gittinger <cg@exept.de>
parents: 2081
diff changeset
   934
2257
1d9e88f6550e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2219
diff changeset
   935
             "/ send a line to stdErr
1d9e88f6550e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2219
diff changeset
   936
1d9e88f6550e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2219
diff changeset
   937
             ('[warning]: ignored error: ' , printedException errorString) errorPrintCR.
1d9e88f6550e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2219
diff changeset
   938
             ('[warning]:    error information appended to ''errorTrace.stx''') errorPrintCR.
1d9e88f6550e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2219
diff changeset
   939
1d9e88f6550e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2219
diff changeset
   940
             AbortSignal raise 
2174
3c6300f27f74 example section;
Claus Gittinger <cg@exept.de>
parents: 2081
diff changeset
   941
      ]
3c6300f27f74 example section;
Claus Gittinger <cg@exept.de>
parents: 2081
diff changeset
   942
3c6300f27f74 example section;
Claus Gittinger <cg@exept.de>
parents: 2081
diff changeset
   943
    "test with (try a few halts or CTRL-C's):
3c6300f27f74 example section;
Claus Gittinger <cg@exept.de>
parents: 2081
diff changeset
   944
     Exception emergencyHandler:(Exception dumpingEmergencyHandler)
3c6300f27f74 example section;
Claus Gittinger <cg@exept.de>
parents: 2081
diff changeset
   945
    "
3c6300f27f74 example section;
Claus Gittinger <cg@exept.de>
parents: 2081
diff changeset
   946
3c6300f27f74 example section;
Claus Gittinger <cg@exept.de>
parents: 2081
diff changeset
   947
    "back with:
3c6300f27f74 example section;
Claus Gittinger <cg@exept.de>
parents: 2081
diff changeset
   948
     Exception emergencyHandler:(Exception notifyingEmergencyHandler)
3c6300f27f74 example section;
Claus Gittinger <cg@exept.de>
parents: 2081
diff changeset
   949
     Exception emergencyHandler:nil
3c6300f27f74 example section;
Claus Gittinger <cg@exept.de>
parents: 2081
diff changeset
   950
    "
3c6300f27f74 example section;
Claus Gittinger <cg@exept.de>
parents: 2081
diff changeset
   951
3c6300f27f74 example section;
Claus Gittinger <cg@exept.de>
parents: 2081
diff changeset
   952
    "Created: 15.1.1997 / 20:14:52 / cg"
2257
1d9e88f6550e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2219
diff changeset
   953
    "Modified: 24.1.1997 / 20:36:21 / cg"
2174
3c6300f27f74 example section;
Claus Gittinger <cg@exept.de>
parents: 2081
diff changeset
   954
!
3c6300f27f74 example section;
Claus Gittinger <cg@exept.de>
parents: 2081
diff changeset
   955
3c6300f27f74 example section;
Claus Gittinger <cg@exept.de>
parents: 2081
diff changeset
   956
mailingEmergencyHandler
3c6300f27f74 example section;
Claus Gittinger <cg@exept.de>
parents: 2081
diff changeset
   957
    "return a block (usable as an emergency handler), 
3c6300f27f74 example section;
Claus Gittinger <cg@exept.de>
parents: 2081
diff changeset
   958
     which shows a warnBox and optionally mails a stackBacktrace to a maintainer.
3c6300f27f74 example section;
Claus Gittinger <cg@exept.de>
parents: 2081
diff changeset
   959
     This is useful, for endUser application, which are still being
3c6300f27f74 example section;
Claus Gittinger <cg@exept.de>
parents: 2081
diff changeset
   960
     debugged (i.e. the programmers may have a look at the errors).
3c6300f27f74 example section;
Claus Gittinger <cg@exept.de>
parents: 2081
diff changeset
   961
3c6300f27f74 example section;
Claus Gittinger <cg@exept.de>
parents: 2081
diff changeset
   962
     Notice: the stuff here is a demonstration only; it should be modified
2208
cc55b9f5b47e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2204
diff changeset
   963
	     for your particular environment ...
cc55b9f5b47e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2204
diff changeset
   964
	     ... but please: copy the code and modify there;
cc55b9f5b47e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2204
diff changeset
   965
	     leave the stuff below as it is."
2174
3c6300f27f74 example section;
Claus Gittinger <cg@exept.de>
parents: 2081
diff changeset
   966
3c6300f27f74 example section;
Claus Gittinger <cg@exept.de>
parents: 2081
diff changeset
   967
    ^ [:ex | 
2208
cc55b9f5b47e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2204
diff changeset
   968
	    |str printedException doMail emergencyMailReceiver pipe|
2174
3c6300f27f74 example section;
Claus Gittinger <cg@exept.de>
parents: 2081
diff changeset
   969
2208
cc55b9f5b47e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2204
diff changeset
   970
	    ex signal == Signal noHandlerSignal ifTrue:[
cc55b9f5b47e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2204
diff changeset
   971
	       printedException := ex parameter.
cc55b9f5b47e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2204
diff changeset
   972
	    ] ifFalse:[
cc55b9f5b47e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2204
diff changeset
   973
	       printedException := ex
cc55b9f5b47e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2204
diff changeset
   974
	    ].
2174
3c6300f27f74 example section;
Claus Gittinger <cg@exept.de>
parents: 2081
diff changeset
   975
2208
cc55b9f5b47e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2204
diff changeset
   976
	     "/ user interruption is handled specially:
cc55b9f5b47e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2204
diff changeset
   977
	     "/ allow user to choose between proceeding or aborting
cc55b9f5b47e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2204
diff changeset
   978
	     "/ but never dump that information to the file.
2174
3c6300f27f74 example section;
Claus Gittinger <cg@exept.de>
parents: 2081
diff changeset
   979
2208
cc55b9f5b47e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2204
diff changeset
   980
	     printedException signal == Object userInterruptSignal ifTrue:[
cc55b9f5b47e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2204
diff changeset
   981
		  (self confirm:'abort current action ?') ifTrue:[
cc55b9f5b47e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2204
diff changeset
   982
		      AbortSignal raise
cc55b9f5b47e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2204
diff changeset
   983
		  ].
cc55b9f5b47e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2204
diff changeset
   984
		  ex proceed
cc55b9f5b47e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2204
diff changeset
   985
	     ].
2174
3c6300f27f74 example section;
Claus Gittinger <cg@exept.de>
parents: 2081
diff changeset
   986
2208
cc55b9f5b47e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2204
diff changeset
   987
	    "/ somehow get the name of the guy to receive the mail
cc55b9f5b47e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2204
diff changeset
   988
	    "/ you have to implement that yourself.
2174
3c6300f27f74 example section;
Claus Gittinger <cg@exept.de>
parents: 2081
diff changeset
   989
2208
cc55b9f5b47e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2204
diff changeset
   990
	    "/ emergencyMailReceiver := OneOfYourClass getEmergencyMailReceiver.
cc55b9f5b47e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2204
diff changeset
   991
	    emergencyMailReceiver := OperatingSystem getLoginName.
2174
3c6300f27f74 example section;
Claus Gittinger <cg@exept.de>
parents: 2081
diff changeset
   992
2208
cc55b9f5b47e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2204
diff changeset
   993
	    emergencyMailReceiver isNil ifTrue:[
cc55b9f5b47e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2204
diff changeset
   994
		self warn:(printedException errorString 
cc55b9f5b47e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2204
diff changeset
   995
			   , '\\No mailing to service people possible.') withCRs.
cc55b9f5b47e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2204
diff changeset
   996
		doMail := false.
cc55b9f5b47e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2204
diff changeset
   997
	    ] ifFalse:[
cc55b9f5b47e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2204
diff changeset
   998
		doMail := self confirm:(printedException errorString 
cc55b9f5b47e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2204
diff changeset
   999
					, '\\Mail error information to the service people (' 
cc55b9f5b47e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2204
diff changeset
  1000
					, emergencyMailReceiver , ') ?') withCRs
cc55b9f5b47e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2204
diff changeset
  1001
	    ].
cc55b9f5b47e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2204
diff changeset
  1002
	    doMail ifTrue:[
cc55b9f5b47e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2204
diff changeset
  1003
		str := '' writeStream.
2174
3c6300f27f74 example section;
Claus Gittinger <cg@exept.de>
parents: 2081
diff changeset
  1004
2208
cc55b9f5b47e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2204
diff changeset
  1005
		str nextPutLine:('Error notification from '
cc55b9f5b47e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2204
diff changeset
  1006
				, OperatingSystem getLoginName
cc55b9f5b47e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2204
diff changeset
  1007
				, '@'
cc55b9f5b47e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2204
diff changeset
  1008
				, OperatingSystem getHostName).
cc55b9f5b47e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2204
diff changeset
  1009
		str cr.
2174
3c6300f27f74 example section;
Claus Gittinger <cg@exept.de>
parents: 2081
diff changeset
  1010
2208
cc55b9f5b47e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2204
diff changeset
  1011
		str nextPutLine:('Time: ' , AbsoluteTime now printString).
cc55b9f5b47e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2204
diff changeset
  1012
		str nextPutLine:('Error: ', printedException errorString).
cc55b9f5b47e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2204
diff changeset
  1013
		str nextPutLine:('Signal: ', printedException signal printString).
cc55b9f5b47e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2204
diff changeset
  1014
		str nextPutLine:('Parameter: ', printedException parameter printString).
cc55b9f5b47e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2204
diff changeset
  1015
		str nextPutLine:('Process: ', Processor activeProcess printString).
cc55b9f5b47e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2204
diff changeset
  1016
		str nextPutLine:'Backtrace:'.
cc55b9f5b47e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2204
diff changeset
  1017
		str cr.
2174
3c6300f27f74 example section;
Claus Gittinger <cg@exept.de>
parents: 2081
diff changeset
  1018
2208
cc55b9f5b47e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2204
diff changeset
  1019
		printedException suspendedContext fullPrintAllOn:str.
cc55b9f5b47e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2204
diff changeset
  1020
		str cr;cr.
2174
3c6300f27f74 example section;
Claus Gittinger <cg@exept.de>
parents: 2081
diff changeset
  1021
2208
cc55b9f5b47e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2204
diff changeset
  1022
		str close.
2174
3c6300f27f74 example section;
Claus Gittinger <cg@exept.de>
parents: 2081
diff changeset
  1023
2208
cc55b9f5b47e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2204
diff changeset
  1024
		pipe := PipeStream 
cc55b9f5b47e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2204
diff changeset
  1025
			    writingTo:'mail ', emergencyMailReceiver.
cc55b9f5b47e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2204
diff changeset
  1026
		pipe notNil ifTrue:[
cc55b9f5b47e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2204
diff changeset
  1027
		    pipe nextPutLine:'Subject: automatic error report'.
cc55b9f5b47e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2204
diff changeset
  1028
		    pipe nextPutAll:str contents.
cc55b9f5b47e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2204
diff changeset
  1029
		    pipe cr.
cc55b9f5b47e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2204
diff changeset
  1030
		    pipe close.
cc55b9f5b47e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2204
diff changeset
  1031
		]
cc55b9f5b47e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2204
diff changeset
  1032
	     ].
2174
3c6300f27f74 example section;
Claus Gittinger <cg@exept.de>
parents: 2081
diff changeset
  1033
2208
cc55b9f5b47e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2204
diff changeset
  1034
	     AbortSignal raise 
2174
3c6300f27f74 example section;
Claus Gittinger <cg@exept.de>
parents: 2081
diff changeset
  1035
      ]
3c6300f27f74 example section;
Claus Gittinger <cg@exept.de>
parents: 2081
diff changeset
  1036
3c6300f27f74 example section;
Claus Gittinger <cg@exept.de>
parents: 2081
diff changeset
  1037
    "test with (try a few halts or CTRL-C's):
3c6300f27f74 example section;
Claus Gittinger <cg@exept.de>
parents: 2081
diff changeset
  1038
     Exception emergencyHandler:(Exception mailingEmergencyHandler)
3c6300f27f74 example section;
Claus Gittinger <cg@exept.de>
parents: 2081
diff changeset
  1039
    "
3c6300f27f74 example section;
Claus Gittinger <cg@exept.de>
parents: 2081
diff changeset
  1040
3c6300f27f74 example section;
Claus Gittinger <cg@exept.de>
parents: 2081
diff changeset
  1041
    "back with:
3c6300f27f74 example section;
Claus Gittinger <cg@exept.de>
parents: 2081
diff changeset
  1042
     Exception emergencyHandler:(Exception notifyingEmergencyHandler)
3c6300f27f74 example section;
Claus Gittinger <cg@exept.de>
parents: 2081
diff changeset
  1043
     Exception emergencyHandler:nil
3c6300f27f74 example section;
Claus Gittinger <cg@exept.de>
parents: 2081
diff changeset
  1044
    "
3c6300f27f74 example section;
Claus Gittinger <cg@exept.de>
parents: 2081
diff changeset
  1045
3c6300f27f74 example section;
Claus Gittinger <cg@exept.de>
parents: 2081
diff changeset
  1046
    "Created: 15.1.1997 / 20:14:52 / cg"
3c6300f27f74 example section;
Claus Gittinger <cg@exept.de>
parents: 2081
diff changeset
  1047
    "Modified: 15.1.1997 / 21:10:28 / cg"
3c6300f27f74 example section;
Claus Gittinger <cg@exept.de>
parents: 2081
diff changeset
  1048
!
3c6300f27f74 example section;
Claus Gittinger <cg@exept.de>
parents: 2081
diff changeset
  1049
3c6300f27f74 example section;
Claus Gittinger <cg@exept.de>
parents: 2081
diff changeset
  1050
notifyingEmergencyHandler
3c6300f27f74 example section;
Claus Gittinger <cg@exept.de>
parents: 2081
diff changeset
  1051
    "return a block (usable as an emergency handler for exceptions), 
3c6300f27f74 example section;
Claus Gittinger <cg@exept.de>
parents: 2081
diff changeset
  1052
     which does errorNotification before going into the debugger."
3c6300f27f74 example section;
Claus Gittinger <cg@exept.de>
parents: 2081
diff changeset
  1053
3c6300f27f74 example section;
Claus Gittinger <cg@exept.de>
parents: 2081
diff changeset
  1054
    ^ [:ex | nil errorNotify:ex errorString from:ex suspendedContext ]
3c6300f27f74 example section;
Claus Gittinger <cg@exept.de>
parents: 2081
diff changeset
  1055
3c6300f27f74 example section;
Claus Gittinger <cg@exept.de>
parents: 2081
diff changeset
  1056
    "test with (try a few halts or CTRL-C's):
3c6300f27f74 example section;
Claus Gittinger <cg@exept.de>
parents: 2081
diff changeset
  1057
     Exception emergencyHandler:(Exception notifyingEmergencyHandler)
3c6300f27f74 example section;
Claus Gittinger <cg@exept.de>
parents: 2081
diff changeset
  1058
    "
3c6300f27f74 example section;
Claus Gittinger <cg@exept.de>
parents: 2081
diff changeset
  1059
3c6300f27f74 example section;
Claus Gittinger <cg@exept.de>
parents: 2081
diff changeset
  1060
    "back with:
3c6300f27f74 example section;
Claus Gittinger <cg@exept.de>
parents: 2081
diff changeset
  1061
     Exception emergencyHandler:nil
3c6300f27f74 example section;
Claus Gittinger <cg@exept.de>
parents: 2081
diff changeset
  1062
    "
3c6300f27f74 example section;
Claus Gittinger <cg@exept.de>
parents: 2081
diff changeset
  1063
3c6300f27f74 example section;
Claus Gittinger <cg@exept.de>
parents: 2081
diff changeset
  1064
    "Modified: 15.1.1997 / 20:15:12 / cg"
362
claus
parents: 345
diff changeset
  1065
! !
claus
parents: 345
diff changeset
  1066
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1067
!Exception methodsFor:'accessing'!
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1068
44
b262907c93ea *** empty log message ***
claus
parents: 12
diff changeset
  1069
errorString 
b262907c93ea *** empty log message ***
claus
parents: 12
diff changeset
  1070
    "return the errorString passsed with the signal raise
b262907c93ea *** empty log message ***
claus
parents: 12
diff changeset
  1071
     (or nil, if there was none)"
b262907c93ea *** empty log message ***
claus
parents: 12
diff changeset
  1072
4438
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3509
diff changeset
  1073
    ^ signal errorStringExtra:errorString with:nil
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3509
diff changeset
  1074
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3509
diff changeset
  1075
    "Modified: / 12.3.1998 / 15:13:28 / stefan"
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3509
diff changeset
  1076
!
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3509
diff changeset
  1077
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3509
diff changeset
  1078
errorString:aString 
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3509
diff changeset
  1079
    "set the errorString.
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3509
diff changeset
  1080
     If it starts with a space, the signals errorString is prepended,
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3509
diff changeset
  1081
     if it ends with a space, it is appended."
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3509
diff changeset
  1082
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3509
diff changeset
  1083
    errorString := aString
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3509
diff changeset
  1084
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3509
diff changeset
  1085
    "Created: / 5.3.1998 / 16:45:29 / stefan"
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3509
diff changeset
  1086
    "Modified: / 12.3.1998 / 15:30:45 / stefan"
44
b262907c93ea *** empty log message ***
claus
parents: 12
diff changeset
  1087
!
b262907c93ea *** empty log message ***
claus
parents: 12
diff changeset
  1088
621
87602c9d071c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 547
diff changeset
  1089
handlerContext
87602c9d071c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 547
diff changeset
  1090
    "return the context of the handler"
87602c9d071c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 547
diff changeset
  1091
87602c9d071c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 547
diff changeset
  1092
    ^ handlerContext
87602c9d071c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 547
diff changeset
  1093
!
87602c9d071c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 547
diff changeset
  1094
362
claus
parents: 345
diff changeset
  1095
originator 
claus
parents: 345
diff changeset
  1096
    "return the originator passsed with the signal raise
claus
parents: 345
diff changeset
  1097
     (or nil, if there was none)"
claus
parents: 345
diff changeset
  1098
claus
parents: 345
diff changeset
  1099
    ^ originator
claus
parents: 345
diff changeset
  1100
!
claus
parents: 345
diff changeset
  1101
4438
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3509
diff changeset
  1102
originator:anObject 
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3509
diff changeset
  1103
    "set the originator"
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3509
diff changeset
  1104
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3509
diff changeset
  1105
    originator := anObject
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3509
diff changeset
  1106
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3509
diff changeset
  1107
    "Created: / 5.3.1998 / 16:34:56 / stefan"
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3509
diff changeset
  1108
!
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3509
diff changeset
  1109
621
87602c9d071c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 547
diff changeset
  1110
parameter
87602c9d071c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 547
diff changeset
  1111
    "return the parameter passsed with the signal raise
87602c9d071c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 547
diff changeset
  1112
     (or nil, if there was none)"
44
b262907c93ea *** empty log message ***
claus
parents: 12
diff changeset
  1113
621
87602c9d071c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 547
diff changeset
  1114
    ^ parameter
68
59faa75185ba *** empty log message ***
claus
parents: 54
diff changeset
  1115
!
59faa75185ba *** empty log message ***
claus
parents: 54
diff changeset
  1116
4438
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3509
diff changeset
  1117
parameter:anObject
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3509
diff changeset
  1118
    "set the parameter of the exception"
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3509
diff changeset
  1119
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3509
diff changeset
  1120
    parameter := anObject
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3509
diff changeset
  1121
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3509
diff changeset
  1122
    "Created: / 5.3.1998 / 16:34:22 / stefan"
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3509
diff changeset
  1123
!
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3509
diff changeset
  1124
68
59faa75185ba *** empty log message ***
claus
parents: 54
diff changeset
  1125
rejected
362
claus
parents: 345
diff changeset
  1126
    "return true, if any other of the exceptions handlers has rejected 
759
908363ce8a32 interest is written with one 'r' (shame on me)
Claus Gittinger <cg@exept.de>
parents: 662
diff changeset
  1127
     Uncertain, if this is really interesting to anybody.
362
claus
parents: 345
diff changeset
  1128
     This is only valid during handler execution.
claus
parents: 345
diff changeset
  1129
     (i.e. an outer handler can find out, if any other handler has already
claus
parents: 345
diff changeset
  1130
     rejected).
claus
parents: 345
diff changeset
  1131
     "
68
59faa75185ba *** empty log message ***
claus
parents: 54
diff changeset
  1132
59faa75185ba *** empty log message ***
claus
parents: 54
diff changeset
  1133
    ^ rejected
362
claus
parents: 345
diff changeset
  1134
!
claus
parents: 345
diff changeset
  1135
621
87602c9d071c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 547
diff changeset
  1136
signal
87602c9d071c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 547
diff changeset
  1137
    "return the signal, that caused the exception"
87602c9d071c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 547
diff changeset
  1138
87602c9d071c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 547
diff changeset
  1139
    ^ signal
87602c9d071c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 547
diff changeset
  1140
!
87602c9d071c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 547
diff changeset
  1141
4438
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3509
diff changeset
  1142
signal:aSignal
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3509
diff changeset
  1143
    "set the signal, that caused the exception"
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3509
diff changeset
  1144
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3509
diff changeset
  1145
    signal := aSignal
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3509
diff changeset
  1146
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3509
diff changeset
  1147
    "Created: / 5.3.1998 / 16:02:46 / stefan"
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3509
diff changeset
  1148
!
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3509
diff changeset
  1149
621
87602c9d071c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 547
diff changeset
  1150
suspendedContext
87602c9d071c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 547
diff changeset
  1151
    "return the context in which the raise occured"
87602c9d071c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 547
diff changeset
  1152
87602c9d071c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 547
diff changeset
  1153
    ^ suspendedContext
87602c9d071c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 547
diff changeset
  1154
!
87602c9d071c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 547
diff changeset
  1155
4438
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3509
diff changeset
  1156
suspendedContext:something
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3509
diff changeset
  1157
    "set the value of the instance variable 'suspendedContext' (automatically generated)"
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3509
diff changeset
  1158
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3509
diff changeset
  1159
    suspendedContext := something.
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3509
diff changeset
  1160
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3509
diff changeset
  1161
    "Created: / 2.3.1998 / 12:43:20 / stefan"
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3509
diff changeset
  1162
!
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3509
diff changeset
  1163
362
claus
parents: 345
diff changeset
  1164
willProceed
claus
parents: 345
diff changeset
  1165
    "return true, if the exception is proceedable"
claus
parents: 345
diff changeset
  1166
4438
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3509
diff changeset
  1167
    ^ resumeBlock notNil and:[proceedable]
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3509
diff changeset
  1168
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3509
diff changeset
  1169
    "Modified: / 2.3.1998 / 12:20:43 / stefan"
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3509
diff changeset
  1170
! !
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3509
diff changeset
  1171
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3509
diff changeset
  1172
!Exception methodsFor:'copying'!
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3509
diff changeset
  1173
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3509
diff changeset
  1174
postCopy
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3509
diff changeset
  1175
    "set the internal state to nil"
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3509
diff changeset
  1176
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3509
diff changeset
  1177
    suspendedContext := handlerContext := rejected := nil
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3509
diff changeset
  1178
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3509
diff changeset
  1179
    "Created: / 2.3.1998 / 12:30:06 / stefan"
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1180
! !
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1181
4445
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
  1182
!Exception methodsFor:'default actions'!
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
  1183
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
  1184
action
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
  1185
    "perform a action for the signal if it hasn't been catched
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
  1186
     We arrive here, if either no handler was found, or none of the
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
  1187
     handlers did a return (i.e. every handler rejected or fell through).
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
  1188
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
  1189
     The default is to evaluate the signal's handlerBlock.
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
  1190
     Subclasses may redefine this."
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
  1191
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
  1192
    |block noHandlerSignal msg|
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
  1193
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
  1194
    "
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
  1195
     try per signal handler
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
  1196
    "
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
  1197
    (block := signal handlerBlock) isNil ifTrue:[
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
  1198
        "/
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
  1199
        "/ if its a querySignal, ignore it
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
  1200
        "/
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
  1201
        signal isQuerySignal ifTrue:[^ nil].
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
  1202
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
  1203
        "/
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
  1204
        "/ if it is not the NoHandlerSignal, raise it ...
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
  1205
        "/ passing the receiver as parameter.
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
  1206
        "/
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
  1207
        signal ~~ (noHandlerSignal := Signal noHandlerSignal) ifTrue:[
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
  1208
            noHandlerSignal notNil ifTrue:[
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
  1209
                handlerContext notNil ifTrue:[
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
  1210
                    msg := 'unhandled (rejected)'
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
  1211
                ] ifFalse:[
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
  1212
                    msg := 'unhandled'
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
  1213
                ].
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
  1214
                msg := msg , ' exception: (' , self errorString , ')'.
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
  1215
                ^ noHandlerSignal 
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
  1216
                      raiseRequestWith:self 
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
  1217
                           errorString:msg
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
  1218
                                    in:self suspendedContext
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
  1219
            ].
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
  1220
            "/
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
  1221
            "/ mhmh - an error during early startup; noHandlerSignal is
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
  1222
            "/ not yet defined.
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
  1223
            "/
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
  1224
            ^ MiniDebugger enterWithMessage:self errorString
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
  1225
        ].
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
  1226
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
  1227
        "
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
  1228
         mhmh - smells like trouble - there is no handler and
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
  1229
         no per-signal handler block.
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
  1230
         Look for either a per-process emergencyHandlerBlock 
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
  1231
         or the global emergencyHandler (from Exception) ...
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
  1232
        "
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
  1233
        Processor notNil ifTrue:[ 
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
  1234
            "care for signal during startup (Processor not yet created)"
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
  1235
            block := Processor activeProcess emergencySignalHandler.
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
  1236
        ].
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
  1237
        block isNil ifTrue:[
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
  1238
            block := Exception emergencyHandler.
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
  1239
            block isNil ifTrue:[
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
  1240
                "care for error during startup (Exception not yet initialized)"
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
  1241
                ^ MiniDebugger enterWithMessage:self errorString
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
  1242
            ].
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
  1243
        ].
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
  1244
    ].
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
  1245
    "... and call it"
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
  1246
    ^ block value:self.
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
  1247
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
  1248
    "Created: / 23.7.1999 / 14:38:03 / stefan"
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
  1249
    "Modified: / 23.7.1999 / 14:41:36 / stefan"
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
  1250
!
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
  1251
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
  1252
mayProceed
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
  1253
    "return true, if the exception handler is allowed to proceed
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
  1254
     the execution where the exception occured.
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
  1255
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
  1256
     Subclasses may redefine this."
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
  1257
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
  1258
    ^ signal mayProceed
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
  1259
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
  1260
    "Created: / 23.7.1999 / 14:48:26 / stefan"
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
  1261
! !
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
  1262
621
87602c9d071c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 547
diff changeset
  1263
!Exception methodsFor:'handler actions'!
87602c9d071c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 547
diff changeset
  1264
87602c9d071c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 547
diff changeset
  1265
proceed
87602c9d071c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 547
diff changeset
  1266
    "Continue after the raise - the raise returns nil"
87602c9d071c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 547
diff changeset
  1267
2509
20e70b07473a clean out exceptions block & context references when
Claus Gittinger <cg@exept.de>
parents: 2433
diff changeset
  1268
    |b|
20e70b07473a clean out exceptions block & context references when
Claus Gittinger <cg@exept.de>
parents: 2433
diff changeset
  1269
4438
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3509
diff changeset
  1270
    resumeBlock isNil ifTrue:[
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3509
diff changeset
  1271
        "signal raiser does not want us to proceed"
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3509
diff changeset
  1272
        Signal proceedErrorSignal raiseWith:self.
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3509
diff changeset
  1273
    ] ifFalse:[
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3509
diff changeset
  1274
        proceedable ifFalse:[
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3509
diff changeset
  1275
            ('WARNING: signal <', signal printString, '> has been raised nonproceedable') errorPrintCR.
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3509
diff changeset
  1276
            ('         by: ', suspendedContext printString) errorPrintCR.
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3509
diff changeset
  1277
            ('         ', thisContext sender printString , ' tries to proceed.') errorPrintCR.
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3509
diff changeset
  1278
            ('         This will be an error in future ST/X versions.') errorPrintCR.
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3509
diff changeset
  1279
        ].
2509
20e70b07473a clean out exceptions block & context references when
Claus Gittinger <cg@exept.de>
parents: 2433
diff changeset
  1280
        b := resumeBlock.
20e70b07473a clean out exceptions block & context references when
Claus Gittinger <cg@exept.de>
parents: 2433
diff changeset
  1281
        resumeBlock := rejectBlock := handlerContext := suspendedContext := nil.
20e70b07473a clean out exceptions block & context references when
Claus Gittinger <cg@exept.de>
parents: 2433
diff changeset
  1282
        b value:nil
20e70b07473a clean out exceptions block & context references when
Claus Gittinger <cg@exept.de>
parents: 2433
diff changeset
  1283
    ]
20e70b07473a clean out exceptions block & context references when
Claus Gittinger <cg@exept.de>
parents: 2433
diff changeset
  1284
4438
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3509
diff changeset
  1285
    "
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3509
diff changeset
  1286
        Object errorSignal handle:[:ex|
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3509
diff changeset
  1287
            ex proceed
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3509
diff changeset
  1288
        ] do:[
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3509
diff changeset
  1289
            Object errorSignal raise
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3509
diff changeset
  1290
        ].
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3509
diff changeset
  1291
    "
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3509
diff changeset
  1292
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3509
diff changeset
  1293
    "Modified: / 27.3.1997 / 16:44:39 / cg"
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3509
diff changeset
  1294
    "Modified: / 2.3.1998 / 12:00:10 / stefan"
621
87602c9d071c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 547
diff changeset
  1295
!
87602c9d071c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 547
diff changeset
  1296
87602c9d071c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 547
diff changeset
  1297
proceedWith:value
87602c9d071c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 547
diff changeset
  1298
    "Continue after the raise - the raise returns value"
87602c9d071c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 547
diff changeset
  1299
2509
20e70b07473a clean out exceptions block & context references when
Claus Gittinger <cg@exept.de>
parents: 2433
diff changeset
  1300
    |b|
20e70b07473a clean out exceptions block & context references when
Claus Gittinger <cg@exept.de>
parents: 2433
diff changeset
  1301
4438
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3509
diff changeset
  1302
    resumeBlock isNil ifTrue:[
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3509
diff changeset
  1303
        "signal raiser does not want us to proceed"
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3509
diff changeset
  1304
        Signal proceedErrorSignal raiseWith:self.
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3509
diff changeset
  1305
    ] ifFalse:[
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3509
diff changeset
  1306
        proceedable ifFalse:[
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3509
diff changeset
  1307
            ('WARNING: signal <', signal printString, '> has been raised nonproceedable') errorPrintCR.
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3509
diff changeset
  1308
            ('         by: ', suspendedContext printString) errorPrintCR.
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3509
diff changeset
  1309
            ('         ', thisContext sender printString , ' tries to proceed.') errorPrintCR.
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3509
diff changeset
  1310
            ('         This will be an error in future ST/X versions.') errorPrintCR.
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3509
diff changeset
  1311
        ].
2509
20e70b07473a clean out exceptions block & context references when
Claus Gittinger <cg@exept.de>
parents: 2433
diff changeset
  1312
        b := resumeBlock.
20e70b07473a clean out exceptions block & context references when
Claus Gittinger <cg@exept.de>
parents: 2433
diff changeset
  1313
        resumeBlock := rejectBlock := handlerContext := suspendedContext := nil.
20e70b07473a clean out exceptions block & context references when
Claus Gittinger <cg@exept.de>
parents: 2433
diff changeset
  1314
        b value:value
20e70b07473a clean out exceptions block & context references when
Claus Gittinger <cg@exept.de>
parents: 2433
diff changeset
  1315
    ]
20e70b07473a clean out exceptions block & context references when
Claus Gittinger <cg@exept.de>
parents: 2433
diff changeset
  1316
4438
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3509
diff changeset
  1317
    "Modified: / 27.3.1997 / 16:45:57 / cg"
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3509
diff changeset
  1318
    "Modified: / 2.3.1998 / 12:02:06 / stefan"
621
87602c9d071c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 547
diff changeset
  1319
!
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1320
621
87602c9d071c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 547
diff changeset
  1321
reject
87602c9d071c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 547
diff changeset
  1322
    "handler decided not to handle this signal -
87602c9d071c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 547
diff changeset
  1323
     system will look for another handler"
87602c9d071c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 547
diff changeset
  1324
87602c9d071c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 547
diff changeset
  1325
    rejected := true.
87602c9d071c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 547
diff changeset
  1326
    rejectBlock value
87602c9d071c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 547
diff changeset
  1327
!
87602c9d071c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 547
diff changeset
  1328
87602c9d071c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 547
diff changeset
  1329
restart
87602c9d071c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 547
diff changeset
  1330
    "restart the handle:do: - usually after some repair work is done
87602c9d071c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 547
diff changeset
  1331
     in handler"
87602c9d071c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 547
diff changeset
  1332
87602c9d071c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 547
diff changeset
  1333
    handlerContext unwindAndRestart
87602c9d071c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 547
diff changeset
  1334
!
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1335
3100
c96f3b203a60 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3091
diff changeset
  1336
restartDo:aBlock
c96f3b203a60 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3091
diff changeset
  1337
    "restart the handle:do: but execute the argument, aBlock instead of the
c96f3b203a60 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3091
diff changeset
  1338
     original do-block - usually after some repair work is done in handler"
c96f3b203a60 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3091
diff changeset
  1339
c96f3b203a60 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3091
diff changeset
  1340
    handlerContext argAt:2 put:aBlock.
c96f3b203a60 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3091
diff changeset
  1341
    handlerContext unwindAndRestart
c96f3b203a60 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3091
diff changeset
  1342
c96f3b203a60 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3091
diff changeset
  1343
    "
c96f3b203a60 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3091
diff changeset
  1344
     |sig rslt|
c96f3b203a60 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3091
diff changeset
  1345
c96f3b203a60 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3091
diff changeset
  1346
     sig := Signal new.
c96f3b203a60 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3091
diff changeset
  1347
c96f3b203a60 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3091
diff changeset
  1348
     sig handle:[:ex |
c96f3b203a60 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3091
diff changeset
  1349
        ex restartDo:[ rslt := 999 ]
c96f3b203a60 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3091
diff changeset
  1350
     ] do:[
c96f3b203a60 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3091
diff changeset
  1351
        rslt := 0.
c96f3b203a60 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3091
diff changeset
  1352
        sig raise
c96f3b203a60 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3091
diff changeset
  1353
     ].
c96f3b203a60 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3091
diff changeset
  1354
c96f3b203a60 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3091
diff changeset
  1355
     Transcript showCR:rslt
c96f3b203a60 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3091
diff changeset
  1356
    "
c96f3b203a60 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3091
diff changeset
  1357
c96f3b203a60 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3091
diff changeset
  1358
    "Modified: / 8.11.1997 / 18:52:28 / cg"
c96f3b203a60 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3091
diff changeset
  1359
!
c96f3b203a60 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3091
diff changeset
  1360
621
87602c9d071c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 547
diff changeset
  1361
resume
4438
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3509
diff changeset
  1362
    "Continue after the raise - the raise returns nil
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3509
diff changeset
  1363
     obsolete (use #proceed), retained for backwards compatibility"
2509
20e70b07473a clean out exceptions block & context references when
Claus Gittinger <cg@exept.de>
parents: 2433
diff changeset
  1364
4438
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3509
diff changeset
  1365
    self obsoleteMethodWarning:'use #proceed'.
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3509
diff changeset
  1366
    ^ self proceed
2509
20e70b07473a clean out exceptions block & context references when
Claus Gittinger <cg@exept.de>
parents: 2433
diff changeset
  1367
4438
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3509
diff changeset
  1368
    "Modified: / 2.3.1998 / 10:51:55 / stefan"
621
87602c9d071c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 547
diff changeset
  1369
!
87602c9d071c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 547
diff changeset
  1370
87602c9d071c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 547
diff changeset
  1371
resumeWith:value
4438
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3509
diff changeset
  1372
    "Continue after the raise - the raise returns value
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3509
diff changeset
  1373
     obsolete (use #proceedWith:), retained for backwards compatibility"
2509
20e70b07473a clean out exceptions block & context references when
Claus Gittinger <cg@exept.de>
parents: 2433
diff changeset
  1374
4438
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3509
diff changeset
  1375
    self obsoleteMethodWarning:'use #proceedWith:'.
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3509
diff changeset
  1376
    ^ self proceedWith:value
2509
20e70b07473a clean out exceptions block & context references when
Claus Gittinger <cg@exept.de>
parents: 2433
diff changeset
  1377
4438
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3509
diff changeset
  1378
    "Modified: / 2.3.1998 / 10:51:48 / stefan"
621
87602c9d071c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 547
diff changeset
  1379
!
87602c9d071c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 547
diff changeset
  1380
87602c9d071c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 547
diff changeset
  1381
return
87602c9d071c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 547
diff changeset
  1382
    "Continue after the handle:do: - the handle:do: returns nil"
87602c9d071c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 547
diff changeset
  1383
2509
20e70b07473a clean out exceptions block & context references when
Claus Gittinger <cg@exept.de>
parents: 2433
diff changeset
  1384
    |con|
20e70b07473a clean out exceptions block & context references when
Claus Gittinger <cg@exept.de>
parents: 2433
diff changeset
  1385
20e70b07473a clean out exceptions block & context references when
Claus Gittinger <cg@exept.de>
parents: 2433
diff changeset
  1386
    con := handlerContext.
20e70b07473a clean out exceptions block & context references when
Claus Gittinger <cg@exept.de>
parents: 2433
diff changeset
  1387
    resumeBlock := rejectBlock := handlerContext := suspendedContext := nil.
20e70b07473a clean out exceptions block & context references when
Claus Gittinger <cg@exept.de>
parents: 2433
diff changeset
  1388
    con unwind
20e70b07473a clean out exceptions block & context references when
Claus Gittinger <cg@exept.de>
parents: 2433
diff changeset
  1389
20e70b07473a clean out exceptions block & context references when
Claus Gittinger <cg@exept.de>
parents: 2433
diff changeset
  1390
    "Modified: 27.3.1997 / 16:46:39 / cg"
621
87602c9d071c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 547
diff changeset
  1391
!
87602c9d071c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 547
diff changeset
  1392
87602c9d071c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 547
diff changeset
  1393
returnDoing:aBlock
87602c9d071c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 547
diff changeset
  1394
    "Continue after the handle:do: - the handle:do: returns aBlock value"
87602c9d071c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 547
diff changeset
  1395
87602c9d071c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 547
diff changeset
  1396
    handlerContext unwindThenDo:aBlock
87602c9d071c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 547
diff changeset
  1397
!
87602c9d071c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 547
diff changeset
  1398
87602c9d071c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 547
diff changeset
  1399
returnWith:value
87602c9d071c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 547
diff changeset
  1400
    "Continue after the handle:do: - the handle:do: returns value"
87602c9d071c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 547
diff changeset
  1401
2509
20e70b07473a clean out exceptions block & context references when
Claus Gittinger <cg@exept.de>
parents: 2433
diff changeset
  1402
    |con|
20e70b07473a clean out exceptions block & context references when
Claus Gittinger <cg@exept.de>
parents: 2433
diff changeset
  1403
20e70b07473a clean out exceptions block & context references when
Claus Gittinger <cg@exept.de>
parents: 2433
diff changeset
  1404
    con := handlerContext.
20e70b07473a clean out exceptions block & context references when
Claus Gittinger <cg@exept.de>
parents: 2433
diff changeset
  1405
    resumeBlock := rejectBlock := handlerContext := suspendedContext := nil.
20e70b07473a clean out exceptions block & context references when
Claus Gittinger <cg@exept.de>
parents: 2433
diff changeset
  1406
    con unwind:value
20e70b07473a clean out exceptions block & context references when
Claus Gittinger <cg@exept.de>
parents: 2433
diff changeset
  1407
20e70b07473a clean out exceptions block & context references when
Claus Gittinger <cg@exept.de>
parents: 2433
diff changeset
  1408
    "Modified: 27.3.1997 / 16:46:51 / cg"
171
129f0e2e23df handling now in Exception
claus
parents: 142
diff changeset
  1409
! !
129f0e2e23df handling now in Exception
claus
parents: 142
diff changeset
  1410
4438
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3509
diff changeset
  1411
!Exception methodsFor:'private'!
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1412
621
87602c9d071c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 547
diff changeset
  1413
doCallHandler:aHandler
87602c9d071c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 547
diff changeset
  1414
    "call the handler proper - needed an extra method
87602c9d071c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 547
diff changeset
  1415
     to have a separate returnContext for the rejectBlock.
87602c9d071c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 547
diff changeset
  1416
     (which is historical, and actually no longer needed)"
87602c9d071c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 547
diff changeset
  1417
87602c9d071c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 547
diff changeset
  1418
    |val|
362
claus
parents: 345
diff changeset
  1419
621
87602c9d071c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 547
diff changeset
  1420
    rejectBlock := [^ self]. "this will return on reject"
87602c9d071c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 547
diff changeset
  1421
    val := aHandler value:self.
87602c9d071c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 547
diff changeset
  1422
    "
87602c9d071c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 547
diff changeset
  1423
     handler fall through - is just like a returnWith:blocks-value
87602c9d071c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 547
diff changeset
  1424
    "
2291
af7652b82404 avoid touching contexts (making them nonLifo) when searching for unwind-contexts,
Claus Gittinger <cg@exept.de>
parents: 2282
diff changeset
  1425
    rejectBlock := nil.
621
87602c9d071c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 547
diff changeset
  1426
    self returnWith:val
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1427
!
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1428
1378
056b3a0928f2 oops - the last one was bogus
Claus Gittinger <cg@exept.de>
parents: 1376
diff changeset
  1429
doRaise
171
129f0e2e23df handling now in Exception
claus
parents: 142
diff changeset
  1430
    "search through the context-calling chain for a 'handle:do:'-context 
1609
21f69f2adef7 when skipping active handlers, must not only look for
Claus Gittinger <cg@exept.de>
parents: 1482
diff changeset
  1431
     to the raising signal, a parent of it, or a SignalSet which includes 
171
129f0e2e23df handling now in Exception
claus
parents: 142
diff changeset
  1432
     the raising signal.
129f0e2e23df handling now in Exception
claus
parents: 142
diff changeset
  1433
     If found, take the contexts 2nd argument (the handler) and evaluate
129f0e2e23df handling now in Exception
claus
parents: 142
diff changeset
  1434
     it with the receiver exception as argument.
217
a0400fdbc933 *** empty log message ***
claus
parents: 213
diff changeset
  1435
     If no handler is found, try per signal handler, or
a0400fdbc933 *** empty log message ***
claus
parents: 213
diff changeset
  1436
     per process handler (if its the noHandlerSignal).
a0400fdbc933 *** empty log message ***
claus
parents: 213
diff changeset
  1437
     Finally fall back to Exceptions emergencyHandler, which is always
1482
f4b65def90e1 oops - correctly look for handlers when exceptions
Claus Gittinger <cg@exept.de>
parents: 1378
diff changeset
  1438
     available and enters the debugger.
f4b65def90e1 oops - correctly look for handlers when exceptions
Claus Gittinger <cg@exept.de>
parents: 1378
diff changeset
  1439
     ATTENTION: the code below depends on being called by #raise or
1609
21f69f2adef7 when skipping active handlers, must not only look for
Claus Gittinger <cg@exept.de>
parents: 1482
diff changeset
  1440
     #raiseRequest for proper operation (it skips the sending context)."
1482
f4b65def90e1 oops - correctly look for handlers when exceptions
Claus Gittinger <cg@exept.de>
parents: 1378
diff changeset
  1441
4445
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
  1442
    |theContext block noHandlerSignal conArg1
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
  1443
     theSignal c ex1 activeHandlers inHandler 
3509
167b22eeac33 unused var removed
Claus Gittinger <cg@exept.de>
parents: 3179
diff changeset
  1444
     lastHandler h r firstHandler|
1482
f4b65def90e1 oops - correctly look for handlers when exceptions
Claus Gittinger <cg@exept.de>
parents: 1378
diff changeset
  1445
4438
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3509
diff changeset
  1446
    "/ is nil a valid originator? If so, we need an extra
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3509
diff changeset
  1447
    "/ instanceVariable to record the originator setting.
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3509
diff changeset
  1448
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3509
diff changeset
  1449
    originator isNil ifTrue:[
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3509
diff changeset
  1450
        originator := suspendedContext homeReceiver
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3509
diff changeset
  1451
    ].
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3509
diff changeset
  1452
3100
c96f3b203a60 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3091
diff changeset
  1453
    theSignal := signal.
1482
f4b65def90e1 oops - correctly look for handlers when exceptions
Claus Gittinger <cg@exept.de>
parents: 1378
diff changeset
  1454
    theSignal isSignal ifFalse:[
2282
e019b9fb2977 fast search for handler
Claus Gittinger <cg@exept.de>
parents: 2257
diff changeset
  1455
        self halt:'unexpected non-Signal in calling context'.
1482
f4b65def90e1 oops - correctly look for handlers when exceptions
Claus Gittinger <cg@exept.de>
parents: 1378
diff changeset
  1456
    ].
171
129f0e2e23df handling now in Exception
claus
parents: 142
diff changeset
  1457
1609
21f69f2adef7 when skipping active handlers, must not only look for
Claus Gittinger <cg@exept.de>
parents: 1482
diff changeset
  1458
"/ 'search handler for: ' print. theSignal displayString printCR.
21f69f2adef7 when skipping active handlers, must not only look for
Claus Gittinger <cg@exept.de>
parents: 1482
diff changeset
  1459
1482
f4b65def90e1 oops - correctly look for handlers when exceptions
Claus Gittinger <cg@exept.de>
parents: 1378
diff changeset
  1460
    inHandler := false.
3100
c96f3b203a60 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3091
diff changeset
  1461
    c := thisContext sender sender.    "the raise/raiseRequest-context"
c96f3b203a60 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3091
diff changeset
  1462
                                       "the signal raise context"
1609
21f69f2adef7 when skipping active handlers, must not only look for
Claus Gittinger <cg@exept.de>
parents: 1482
diff changeset
  1463
2204
0ec2bd49dd82 comment
Claus Gittinger <cg@exept.de>
parents: 2174
diff changeset
  1464
    "/ since the exceptionHandler is evaluated onTop of the
0ec2bd49dd82 comment
Claus Gittinger <cg@exept.de>
parents: 2174
diff changeset
  1465
    "/ contextChain, we must skip active handlers before searching.
0ec2bd49dd82 comment
Claus Gittinger <cg@exept.de>
parents: 2174
diff changeset
  1466
    "/ otherwise, we get into trouble, when re-raising an exception
0ec2bd49dd82 comment
Claus Gittinger <cg@exept.de>
parents: 2174
diff changeset
  1467
    "/ from within a handler (which would lead to re-executing the
0ec2bd49dd82 comment
Claus Gittinger <cg@exept.de>
parents: 2174
diff changeset
  1468
    "/ same handler)
0ec2bd49dd82 comment
Claus Gittinger <cg@exept.de>
parents: 2174
diff changeset
  1469
    "/ the code below collects active handlers ...
0ec2bd49dd82 comment
Claus Gittinger <cg@exept.de>
parents: 2174
diff changeset
  1470
3066
eb7489e8275a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3017
diff changeset
  1471
    "/ on the fly, look for the first #handle:do: - context,
eb7489e8275a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3017
diff changeset
  1472
    "/ and remember it (as firstHandler) to avoid walking the context chain twice
eb7489e8275a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3017
diff changeset
  1473
    "/ in most cases ...
2291
af7652b82404 avoid touching contexts (making them nonLifo) when searching for unwind-contexts,
Claus Gittinger <cg@exept.de>
parents: 2282
diff changeset
  1474
3066
eb7489e8275a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3017
diff changeset
  1475
    firstHandler := nil.
2208
cc55b9f5b47e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2204
diff changeset
  1476
3066
eb7489e8275a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3017
diff changeset
  1477
    [c notNil] whileTrue:[
eb7489e8275a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3017
diff changeset
  1478
        firstHandler isNil ifTrue:[
eb7489e8275a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3017
diff changeset
  1479
            c := c findNextContextWithSelector:#doRaise or:#'handle:do:' or:#'handle:from:do:'.
eb7489e8275a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3017
diff changeset
  1480
        ] ifFalse:[
eb7489e8275a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3017
diff changeset
  1481
            c := c findNextContextWithSelector:#doRaise or:nil or:nil.
eb7489e8275a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3017
diff changeset
  1482
        ].
eb7489e8275a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3017
diff changeset
  1483
        c notNil ifTrue:[
eb7489e8275a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3017
diff changeset
  1484
            (c selector == #doRaise) ifTrue:[
1609
21f69f2adef7 when skipping active handlers, must not only look for
Claus Gittinger <cg@exept.de>
parents: 1482
diff changeset
  1485
3066
eb7489e8275a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3017
diff changeset
  1486
                ex1 := c receiver.
eb7489e8275a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3017
diff changeset
  1487
eb7489e8275a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3017
diff changeset
  1488
                ((ex1 class == self class)
eb7489e8275a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3017
diff changeset
  1489
                or:[ex1 species == self species]) ifTrue:[
4438
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3509
diff changeset
  1490
                    (ex1 signal == theSignal) ifTrue:[
3110
9a1e3a736e14 better handler search
Claus Gittinger <cg@exept.de>
parents: 3100
diff changeset
  1491
                        h := ex1 handlerContext.
9a1e3a736e14 better handler search
Claus Gittinger <cg@exept.de>
parents: 3100
diff changeset
  1492
                        h notNil ifTrue:[
9a1e3a736e14 better handler search
Claus Gittinger <cg@exept.de>
parents: 3100
diff changeset
  1493
                            r := h receiver.
9a1e3a736e14 better handler search
Claus Gittinger <cg@exept.de>
parents: 3100
diff changeset
  1494
                            (r notNil and:[r accepts:theSignal]) ifTrue:[
9a1e3a736e14 better handler search
Claus Gittinger <cg@exept.de>
parents: 3100
diff changeset
  1495
                                activeHandlers isNil ifTrue:[
9a1e3a736e14 better handler search
Claus Gittinger <cg@exept.de>
parents: 3100
diff changeset
  1496
                                    activeHandlers := OrderedCollection new
9a1e3a736e14 better handler search
Claus Gittinger <cg@exept.de>
parents: 3100
diff changeset
  1497
                                ].
2208
cc55b9f5b47e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2204
diff changeset
  1498
3110
9a1e3a736e14 better handler search
Claus Gittinger <cg@exept.de>
parents: 3100
diff changeset
  1499
                                lastHandler := h.
9a1e3a736e14 better handler search
Claus Gittinger <cg@exept.de>
parents: 3100
diff changeset
  1500
                                activeHandlers add:lastHandler.
9a1e3a736e14 better handler search
Claus Gittinger <cg@exept.de>
parents: 3100
diff changeset
  1501
                                inHandler := true.
9a1e3a736e14 better handler search
Claus Gittinger <cg@exept.de>
parents: 3100
diff changeset
  1502
                                c := lastHandler.
3066
eb7489e8275a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3017
diff changeset
  1503
                            ]
2282
e019b9fb2977 fast search for handler
Claus Gittinger <cg@exept.de>
parents: 2257
diff changeset
  1504
                        ]
e019b9fb2977 fast search for handler
Claus Gittinger <cg@exept.de>
parents: 2257
diff changeset
  1505
                    ]
e019b9fb2977 fast search for handler
Claus Gittinger <cg@exept.de>
parents: 2257
diff changeset
  1506
                ]
3066
eb7489e8275a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3017
diff changeset
  1507
            ] ifFalse:[
eb7489e8275a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3017
diff changeset
  1508
                "/ must be a #handle:do context ...
eb7489e8275a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3017
diff changeset
  1509
                firstHandler := c.
2291
af7652b82404 avoid touching contexts (making them nonLifo) when searching for unwind-contexts,
Claus Gittinger <cg@exept.de>
parents: 2282
diff changeset
  1510
            ]
2282
e019b9fb2977 fast search for handler
Claus Gittinger <cg@exept.de>
parents: 2257
diff changeset
  1511
        ]
1482
f4b65def90e1 oops - correctly look for handlers when exceptions
Claus Gittinger <cg@exept.de>
parents: 1378
diff changeset
  1512
    ].
171
129f0e2e23df handling now in Exception
claus
parents: 142
diff changeset
  1513
2208
cc55b9f5b47e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2204
diff changeset
  1514
    "/ now, start searching for a handler,
3066
eb7489e8275a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3017
diff changeset
  1515
    "/ start search above the last active handler.
eb7489e8275a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3017
diff changeset
  1516
    "/ Or start with the first handle:do: context, if one
eb7489e8275a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3017
diff changeset
  1517
    "/ was found as a side effect of the previous handler search.
eb7489e8275a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3017
diff changeset
  1518
    "/ If nil, then there is no handler and we can directly proceed
eb7489e8275a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3017
diff changeset
  1519
    "/ to the unhandled code below.
2208
cc55b9f5b47e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2204
diff changeset
  1520
3179
f22e94c6ae83 oops - handler within a handler block did not catch
Claus Gittinger <cg@exept.de>
parents: 3111
diff changeset
  1521
"/    lastHandler notNil ifTrue:[
f22e94c6ae83 oops - handler within a handler block did not catch
Claus Gittinger <cg@exept.de>
parents: 3111
diff changeset
  1522
"/        theContext := lastHandler.
f22e94c6ae83 oops - handler within a handler block did not catch
Claus Gittinger <cg@exept.de>
parents: 3111
diff changeset
  1523
"/        theContext := lastHandler findNextContextWithSelector:#'handle:do:' or:#'handle:from:do:' or:nil.
f22e94c6ae83 oops - handler within a handler block did not catch
Claus Gittinger <cg@exept.de>
parents: 3111
diff changeset
  1524
"/    ] ifFalse:[
f22e94c6ae83 oops - handler within a handler block did not catch
Claus Gittinger <cg@exept.de>
parents: 3111
diff changeset
  1525
        theContext := firstHandler.
f22e94c6ae83 oops - handler within a handler block did not catch
Claus Gittinger <cg@exept.de>
parents: 3111
diff changeset
  1526
"/    ].
1609
21f69f2adef7 when skipping active handlers, must not only look for
Claus Gittinger <cg@exept.de>
parents: 1482
diff changeset
  1527
2291
af7652b82404 avoid touching contexts (making them nonLifo) when searching for unwind-contexts,
Claus Gittinger <cg@exept.de>
parents: 2282
diff changeset
  1528
    [theContext notNil] whileTrue:[
3066
eb7489e8275a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3017
diff changeset
  1529
        (theContext selector == #'handle:do:'
eb7489e8275a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3017
diff changeset
  1530
        or:[(theContext argAt:2) == originator]) 
eb7489e8275a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3017
diff changeset
  1531
        ifTrue:[
eb7489e8275a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3017
diff changeset
  1532
            (activeHandlers notNil
eb7489e8275a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3017
diff changeset
  1533
             and:[activeHandlers includesIdentical:theContext]) ifTrue:[
3068
e022c6c4e588 removed debugPrint
Claus Gittinger <cg@exept.de>
parents: 3066
diff changeset
  1534
"/                'skip activeHandler: ' print. theContext displayString printCR.
1482
f4b65def90e1 oops - correctly look for handlers when exceptions
Claus Gittinger <cg@exept.de>
parents: 1378
diff changeset
  1535
3066
eb7489e8275a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3017
diff changeset
  1536
            ] ifFalse:[
eb7489e8275a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3017
diff changeset
  1537
                "
eb7489e8275a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3017
diff changeset
  1538
                 if this is the Signal>>handle:do: context
eb7489e8275a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3017
diff changeset
  1539
                 or a SignalSet>>handle:do: context with self in it,
eb7489e8275a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3017
diff changeset
  1540
                 call the handler
eb7489e8275a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3017
diff changeset
  1541
                "
eb7489e8275a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3017
diff changeset
  1542
                r := theContext receiver.
eb7489e8275a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3017
diff changeset
  1543
                (r notNil and:[r accepts:signal]) ifTrue:[
eb7489e8275a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3017
diff changeset
  1544
                    "call the handler"
1482
f4b65def90e1 oops - correctly look for handlers when exceptions
Claus Gittinger <cg@exept.de>
parents: 1378
diff changeset
  1545
3066
eb7489e8275a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3017
diff changeset
  1546
                    conArg1 := theContext argAt:1.
1482
f4b65def90e1 oops - correctly look for handlers when exceptions
Claus Gittinger <cg@exept.de>
parents: 1378
diff changeset
  1547
3066
eb7489e8275a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3017
diff changeset
  1548
                    handlerContext := theContext.
1482
f4b65def90e1 oops - correctly look for handlers when exceptions
Claus Gittinger <cg@exept.de>
parents: 1378
diff changeset
  1549
3066
eb7489e8275a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3017
diff changeset
  1550
                    self doCallHandler:conArg1.
1482
f4b65def90e1 oops - correctly look for handlers when exceptions
Claus Gittinger <cg@exept.de>
parents: 1378
diff changeset
  1551
3066
eb7489e8275a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3017
diff changeset
  1552
                    "/ if the handler rejects, we arrive here
eb7489e8275a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3017
diff changeset
  1553
                    "/ continue search for another handler
eb7489e8275a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3017
diff changeset
  1554
                ].
2291
af7652b82404 avoid touching contexts (making them nonLifo) when searching for unwind-contexts,
Claus Gittinger <cg@exept.de>
parents: 2282
diff changeset
  1555
            ]
3066
eb7489e8275a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3017
diff changeset
  1556
        ].
eb7489e8275a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3017
diff changeset
  1557
        theContext := theContext findNextContextWithSelector:#'handle:do:' or:#'handle:from:do:' or:nil.
1482
f4b65def90e1 oops - correctly look for handlers when exceptions
Claus Gittinger <cg@exept.de>
parents: 1378
diff changeset
  1558
    ].
f4b65def90e1 oops - correctly look for handlers when exceptions
Claus Gittinger <cg@exept.de>
parents: 1378
diff changeset
  1559
f4b65def90e1 oops - correctly look for handlers when exceptions
Claus Gittinger <cg@exept.de>
parents: 1378
diff changeset
  1560
    activeHandlers := nil.
f4b65def90e1 oops - correctly look for handlers when exceptions
Claus Gittinger <cg@exept.de>
parents: 1378
diff changeset
  1561
171
129f0e2e23df handling now in Exception
claus
parents: 142
diff changeset
  1562
    "
129f0e2e23df handling now in Exception
claus
parents: 142
diff changeset
  1563
     we arrive here, if either no handler was found, or none of the
129f0e2e23df handling now in Exception
claus
parents: 142
diff changeset
  1564
     handlers did a return (i.e. every handler rejected or fell through).
129f0e2e23df handling now in Exception
claus
parents: 142
diff changeset
  1565
    "
1118
1037616d9add ignore unhandled querySignals
Claus Gittinger <cg@exept.de>
parents: 1038
diff changeset
  1566
4445
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
  1567
    ^ self action
1118
1037616d9add ignore unhandled querySignals
Claus Gittinger <cg@exept.de>
parents: 1038
diff changeset
  1568
3066
eb7489e8275a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3017
diff changeset
  1569
    "Created: / 12.5.1996 / 15:09:39 / cg"
3100
c96f3b203a60 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3091
diff changeset
  1570
    "Modified: / 9.11.1997 / 14:48:44 / cg"
4445
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
  1571
    "Modified: / 23.7.1999 / 14:40:12 / stefan"
4438
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3509
diff changeset
  1572
! !
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3509
diff changeset
  1573
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3509
diff changeset
  1574
!Exception methodsFor:'raising'!
1378
056b3a0928f2 oops - the last one was bogus
Claus Gittinger <cg@exept.de>
parents: 1376
diff changeset
  1575
056b3a0928f2 oops - the last one was bogus
Claus Gittinger <cg@exept.de>
parents: 1376
diff changeset
  1576
raise
4438
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3509
diff changeset
  1577
    "actually raise a non-proceedable exception
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3509
diff changeset
  1578
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3509
diff changeset
  1579
     In the past, ST/X did not distinguish between proceedable and
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3509
diff changeset
  1580
     non-proceedable signals (signals invoked with #raise could proceed).
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3509
diff changeset
  1581
     To allow a migration of old applications, we do not invoke a signal
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3509
diff changeset
  1582
     but print out a warning, when trying to proceed a non-proceedable signal.
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3509
diff changeset
  1583
     In the next release, this will raise a signal, so fix your code"
1378
056b3a0928f2 oops - the last one was bogus
Claus Gittinger <cg@exept.de>
parents: 1376
diff changeset
  1584
4438
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3509
diff changeset
  1585
    suspendedContext isNil ifTrue:[
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3509
diff changeset
  1586
        "Call chain:
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3509
diff changeset
  1587
           (origin)>>someMethod         sender
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3509
diff changeset
  1588
           Signal>>raise                sender
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3509
diff changeset
  1589
           Exception>>raise             thisContext
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3509
diff changeset
  1590
        "
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3509
diff changeset
  1591
        suspendedContext := thisContext sender sender
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3509
diff changeset
  1592
    ].
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3509
diff changeset
  1593
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3509
diff changeset
  1594
    "/ remove the next 2 lines to make proceeding from non-proceedable signals an error.
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3509
diff changeset
  1595
    proceedable := false.
1378
056b3a0928f2 oops - the last one was bogus
Claus Gittinger <cg@exept.de>
parents: 1376
diff changeset
  1596
    resumeBlock := [:value | ^ value].
4438
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3509
diff changeset
  1597
1378
056b3a0928f2 oops - the last one was bogus
Claus Gittinger <cg@exept.de>
parents: 1376
diff changeset
  1598
    ^ self doRaise
056b3a0928f2 oops - the last one was bogus
Claus Gittinger <cg@exept.de>
parents: 1376
diff changeset
  1599
4438
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3509
diff changeset
  1600
    "Modified: / 12.5.1996 / 15:09:47 / cg"
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3509
diff changeset
  1601
    "Modified: / 5.3.1998 / 16:40:23 / stefan"
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1602
!
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1603
621
87602c9d071c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 547
diff changeset
  1604
raiseRequest
87602c9d071c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 547
diff changeset
  1605
    "actually raise a proceedable exception."
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1606
4438
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3509
diff changeset
  1607
    suspendedContext isNil ifTrue:[
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3509
diff changeset
  1608
        "Call chain:
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3509
diff changeset
  1609
           (origin)>>someMethod         sender
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3509
diff changeset
  1610
           Signal>>raise                sender
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3509
diff changeset
  1611
           Exception>>raise             thisContext
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3509
diff changeset
  1612
        "
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3509
diff changeset
  1613
        suspendedContext := thisContext sender sender
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3509
diff changeset
  1614
    ].
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3509
diff changeset
  1615
4445
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
  1616
    self mayProceed ifFalse:[
4438
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3509
diff changeset
  1617
        "/ proceeding from wrongProceedabilitySignal grants the raiseRequest
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3509
diff changeset
  1618
        Signal wrongProceedabilitySignal raiseRequestWith:signal in:suspendedContext
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3509
diff changeset
  1619
    ].
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3509
diff changeset
  1620
    proceedable := true.
1378
056b3a0928f2 oops - the last one was bogus
Claus Gittinger <cg@exept.de>
parents: 1376
diff changeset
  1621
    resumeBlock := [:value | ^ value].
056b3a0928f2 oops - the last one was bogus
Claus Gittinger <cg@exept.de>
parents: 1376
diff changeset
  1622
    ^ self doRaise
1376
6757590defbf avoid extra send (raise->evaluateHandler)
Claus Gittinger <cg@exept.de>
parents: 1363
diff changeset
  1623
4438
0b01443d07c1 Add proceedability stuff.
Stefan Vogel <sv@exept.de>
parents: 3509
diff changeset
  1624
    "Modified: / 12.5.1996 / 15:09:44 / cg"
4445
7011a3da6c72 First shot on class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
  1625
    "Modified: / 23.7.1999 / 14:48:48 / stefan"
621
87602c9d071c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 547
diff changeset
  1626
! !
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1627
621
87602c9d071c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 547
diff changeset
  1628
!Exception methodsFor:'setup'!
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1629
4441
018f14253f8a checkin from browser
Stefan Vogel <sv@exept.de>
parents: 4439
diff changeset
  1630
signal:aSignal originator:origin
018f14253f8a checkin from browser
Stefan Vogel <sv@exept.de>
parents: 4439
diff changeset
  1631
    "set the fields usable for inspection by the handler
018f14253f8a checkin from browser
Stefan Vogel <sv@exept.de>
parents: 4439
diff changeset
  1632
     - only to be sent from the signal when raising"
018f14253f8a checkin from browser
Stefan Vogel <sv@exept.de>
parents: 4439
diff changeset
  1633
018f14253f8a checkin from browser
Stefan Vogel <sv@exept.de>
parents: 4439
diff changeset
  1634
    signal := aSignal.
018f14253f8a checkin from browser
Stefan Vogel <sv@exept.de>
parents: 4439
diff changeset
  1635
    originator := origin.
018f14253f8a checkin from browser
Stefan Vogel <sv@exept.de>
parents: 4439
diff changeset
  1636
018f14253f8a checkin from browser
Stefan Vogel <sv@exept.de>
parents: 4439
diff changeset
  1637
    "Created: / 23.7.1999 / 13:39:35 / stefan"
018f14253f8a checkin from browser
Stefan Vogel <sv@exept.de>
parents: 4439
diff changeset
  1638
!
018f14253f8a checkin from browser
Stefan Vogel <sv@exept.de>
parents: 4439
diff changeset
  1639
621
87602c9d071c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 547
diff changeset
  1640
signal:aSignal parameter:aParameter errorString:aString suspendedContext:sContext originator:origin
87602c9d071c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 547
diff changeset
  1641
    "set the fields usable for inspection by the handler
87602c9d071c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 547
diff changeset
  1642
     - only to be sent from the signal when raising"
328
claus
parents: 326
diff changeset
  1643
621
87602c9d071c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 547
diff changeset
  1644
    signal := aSignal.
87602c9d071c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 547
diff changeset
  1645
    parameter := aParameter.
87602c9d071c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 547
diff changeset
  1646
    errorString := aString.
87602c9d071c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 547
diff changeset
  1647
    suspendedContext := sContext.
87602c9d071c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 547
diff changeset
  1648
    originator := origin.
87602c9d071c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 547
diff changeset
  1649
! !
328
claus
parents: 326
diff changeset
  1650
1953
c8a3af54acb3 unhandled querySignals should return nil
Claus Gittinger <cg@exept.de>
parents: 1710
diff changeset
  1651
!Exception class methodsFor:'documentation'!
662
df7953db3847 version method at the end
Claus Gittinger <cg@exept.de>
parents: 621
diff changeset
  1652
df7953db3847 version method at the end
Claus Gittinger <cg@exept.de>
parents: 621
diff changeset
  1653
version
4447
b41133d7941b Add signal creation methods.
Stefan Vogel <sv@exept.de>
parents: 4445
diff changeset
  1654
    ^ '$Header: /cvs/stx/stx/libbasic/Exception.st,v 1.69 1999-07-23 18:13:00 stefan Exp $'
662
df7953db3847 version method at the end
Claus Gittinger <cg@exept.de>
parents: 621
diff changeset
  1655
! !
621
87602c9d071c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 547
diff changeset
  1656
Exception initialize!