GenericException.st
author Stefan Vogel <sv@exept.de>
Tue, 11 Mar 2014 10:27:34 +0100
changeset 16248 933761e57891
parent 16224 2194bc886b30
child 16500 f23b937921c5
permissions -rw-r--r--
class: GenericException changed: #isResumable same as mayProceed (that cares for nil proceedable instVar)
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
4481
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     1
"
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     2
 COPYRIGHT (c) 1993 by Claus Gittinger
8617
5fb5a717deff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8509
diff changeset
     3
              All Rights Reserved
4481
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     4
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     5
 This software is furnished under a license and may be used
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     6
 only in accordance with the terms of that license and with the
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     7
 inclusion of the above copyright notice.   This software may not
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     8
 be provided or otherwise made available to, or used by, any
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     9
 other person.  No title to or ownership of the software is
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    10
 hereby transferred.
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    11
"
5348
8220f8db1cc1 added #signalWith: for ANSI compatibility.
Claus Gittinger <cg@exept.de>
parents: 5295
diff changeset
    12
"{ Package: 'stx:libbasic' }"
8220f8db1cc1 added #signalWith: for ANSI compatibility.
Claus Gittinger <cg@exept.de>
parents: 5295
diff changeset
    13
4481
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    14
Object subclass:#GenericException
9992
0774694cf9b3 - Add raiseContext as instance variable for faster #resume
Stefan Vogel <sv@exept.de>
parents: 9505
diff changeset
    15
	instanceVariableNames:'signal parameter messageText suspendedContext raiseContext
0774694cf9b3 - Add raiseContext as instance variable for faster #resume
Stefan Vogel <sv@exept.de>
parents: 9505
diff changeset
    16
		handlerContext rejected originator proceedable'
8677
d09ee4c45c17 categories and comments
Stefan Vogel <sv@exept.de>
parents: 8617
diff changeset
    17
	classVariableNames:'StrictRaising'
d09ee4c45c17 categories and comments
Stefan Vogel <sv@exept.de>
parents: 8617
diff changeset
    18
	poolDictionaries:''
d09ee4c45c17 categories and comments
Stefan Vogel <sv@exept.de>
parents: 8617
diff changeset
    19
	category:'Kernel-Exceptions'
4481
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    20
!
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    21
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    22
GenericException class instanceVariableNames:'NotifierString'
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    23
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    24
"
5259
cda0ce95054d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5197
diff changeset
    25
 No other class instance variables are inherited by this class.
4481
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    26
"
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    27
!
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    28
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    29
!GenericException class methodsFor:'documentation'!
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    30
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    31
copyright
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    32
"
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    33
 COPYRIGHT (c) 1993 by Claus Gittinger
8617
5fb5a717deff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8509
diff changeset
    34
              All Rights Reserved
4481
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    35
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    36
 This software is furnished under a license and may be used
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    37
 only in accordance with the terms of that license and with the
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    38
 inclusion of the above copyright notice.   This software may not
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    39
 be provided or otherwise made available to, or used by, any
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    40
 other person.  No title to or ownership of the software is
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    41
 hereby transferred.
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    42
"
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    43
!
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    44
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    45
documentation
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    46
"
8617
5fb5a717deff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8509
diff changeset
    47
    Note:
5fb5a717deff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8509
diff changeset
    48
        The instance based Signal framework is being replaced by
5fb5a717deff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8509
diff changeset
    49
        class based exceptions.
5fb5a717deff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8509
diff changeset
    50
        I.e. what used to be instances of Signal/QuerySignal is beeing
5fb5a717deff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8509
diff changeset
    51
        rewritten into subclasses of Exception/Error/Query and Warning.
5fb5a717deff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8509
diff changeset
    52
        Although the functionality is basically unchanged, the new
5fb5a717deff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8509
diff changeset
    53
        class based exceptions are easier to instanciate (no need for
5fb5a717deff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8509
diff changeset
    54
        creation in a classes initialize method), easier to use (no real
5fb5a717deff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8509
diff changeset
    55
        need for SIgnal-constant accessors) and allow for easier parameter
5fb5a717deff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8509
diff changeset
    56
        passing (not only a single parameter, but allows for individual
5fb5a717deff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8509
diff changeset
    57
        exception subclasses to add additional state).
6430
9a1580465dd2 better impl. of #deferAfter:
Claus Gittinger <cg@exept.de>
parents: 6426
diff changeset
    58
4481
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    59
    GenericException and its subclasses implement the same protocol as Signal.
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    60
    So class based exceptions may be implemented as subclasses of GenericException.
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    61
7631
df27883aa7db Undo previous change form cg (on his request!).
Stefan Vogel <sv@exept.de>
parents: 7597
diff changeset
    62
    Normally all exceptions are subclasses of Exception. Exceptions, that are
df27883aa7db Undo previous change form cg (on his request!).
Stefan Vogel <sv@exept.de>
parents: 7597
diff changeset
    63
    used for debugging or that are signalling errors in the exception system itself
df27883aa7db Undo previous change form cg (on his request!).
Stefan Vogel <sv@exept.de>
parents: 7597
diff changeset
    64
    are direct subclasses of GenericException.
df27883aa7db Undo previous change form cg (on his request!).
Stefan Vogel <sv@exept.de>
parents: 7597
diff changeset
    65
4481
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    66
    Instances of Exception are passed to a Signal handling block as argument.
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    67
    The handler block may perform various actions by sending corresponding messages
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    68
    to the exception object. The following actions are possible:
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    69
8617
5fb5a717deff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8509
diff changeset
    70
        reject          - don't handle this signal;
5fb5a717deff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8509
diff changeset
    71
                          another handler will be searched for,
5fb5a717deff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8509
diff changeset
    72
                          upper in the calling hierarchy
5fb5a717deff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8509
diff changeset
    73
5fb5a717deff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8509
diff changeset
    74
        proceed         - return from the Signal>>raise, with nil as value
5fb5a717deff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8509
diff changeset
    75
5fb5a717deff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8509
diff changeset
    76
        proceedWith:val - same, but return val from Signal>>raise
5fb5a717deff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8509
diff changeset
    77
5fb5a717deff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8509
diff changeset
    78
        return          - return from the Signal>>handle:do:, with nil as value
5fb5a717deff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8509
diff changeset
    79
5fb5a717deff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8509
diff changeset
    80
        returnWith:val  - same, but return val from Signal>>handle:do:
15681
3e8d83ce8f96 class: GenericException
Claus Gittinger <cg@exept.de>
parents: 15669
diff changeset
    81
                          (this is also the handler's default,
8617
5fb5a717deff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8509
diff changeset
    82
                           if it falls through; taking the handlerBlocks value
5fb5a717deff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8509
diff changeset
    83
                           as return value)
5fb5a717deff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8509
diff changeset
    84
5fb5a717deff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8509
diff changeset
    85
        restart         - restart the Signal>>handle:do:, after repairing
4481
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    86
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    87
    Via the Exception object, the handler can also query the state of execution:
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    88
    where the Signal was raised, where the handler is, the signal which caused
8313
2aa626e8e404 Fix do not execute an exception handler inside the do-block, when the
Stefan Vogel <sv@exept.de>
parents: 8254
diff changeset
    89
    the error and the messageText passed when the signal was raised. Also, an optional
4481
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    90
    parameter can be passed - the use is signal specific.
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    91
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    92
    [instance variables:]
8617
5fb5a717deff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8509
diff changeset
    93
        signal           <Signal>     the signal which caused the exception
5fb5a717deff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8509
diff changeset
    94
5fb5a717deff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8509
diff changeset
    95
        parameter        <Object>     a parameter (if any) which was passed when raising
5fb5a717deff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8509
diff changeset
    96
                                      the signal (only if raised with #raiseWith:aParameter)
5fb5a717deff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8509
diff changeset
    97
5fb5a717deff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8509
diff changeset
    98
        messageText      <String>     an messageText
5fb5a717deff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8509
diff changeset
    99
                                      (usually the signals own messageText, but sometimes
5fb5a717deff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8509
diff changeset
   100
                                       changed explicitely in #raiseWith:errorString:)
5fb5a717deff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8509
diff changeset
   101
5fb5a717deff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8509
diff changeset
   102
        suspendedContext <Context>    the context in which the raise occured
5fb5a717deff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8509
diff changeset
   103
5fb5a717deff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8509
diff changeset
   104
        handlerContext   <Context>    the context of the handler (if any)
5fb5a717deff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8509
diff changeset
   105
5fb5a717deff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8509
diff changeset
   106
    In case of an unhandled signal raise, Exceptions EmergenyHandler will be evaluated.
4481
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   107
    The default emergeny handler will enter the debugger.
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   108
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   109
    For applications, which do not want Debuggers to come up, other handlers are
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   110
    possible.
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   111
    For example, to get the typical C++ behavior, use:
8617
5fb5a717deff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8509
diff changeset
   112
        Exception emergencyHandler:[:ex | Smalltalk exitWithCoreDump]
4481
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   113
6430
9a1580465dd2 better impl. of #deferAfter:
Claus Gittinger <cg@exept.de>
parents: 6426
diff changeset
   114
9a1580465dd2 better impl. of #deferAfter:
Claus Gittinger <cg@exept.de>
parents: 6426
diff changeset
   115
    Raising:
8617
5fb5a717deff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8509
diff changeset
   116
        two different raising messages are to be used,
5fb5a717deff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8509
diff changeset
   117
        depending on whether the exception is proceedable or not
5fb5a717deff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8509
diff changeset
   118
5fb5a717deff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8509
diff changeset
   119
        For some stupid reason, someone decided that the raise-code checks if
5fb5a717deff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8509
diff changeset
   120
        the raising messages matches to what the signal thinks is its proceedability.
5fb5a717deff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8509
diff changeset
   121
        (i.e. not only do both the sender and the signal itself specify proceedability,
5fb5a717deff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8509
diff changeset
   122
         this is checked by the raise code and a warning is generated if there is a mismatch)
5fb5a717deff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8509
diff changeset
   123
        This used to be even worse (WrongProceedabilityError), but we relaxed this to
5fb5a717deff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8509
diff changeset
   124
        a message sent to stderr.
5fb5a717deff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8509
diff changeset
   125
5fb5a717deff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8509
diff changeset
   126
        That means, that PROCEEDABLE signals must be raised with:
5fb5a717deff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8509
diff changeset
   127
            raiseRequest
5fb5a717deff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8509
diff changeset
   128
        and NON-PROCEEDABLE signals must be raised with:
5fb5a717deff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8509
diff changeset
   129
            raise
5fb5a717deff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8509
diff changeset
   130
5fb5a717deff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8509
diff changeset
   131
        If you dont know/care as a raiser, you can use
5fb5a717deff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8509
diff changeset
   132
            raiseSignal
5fb5a717deff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8509
diff changeset
   133
        which checks for proceedability and sends the appropriate message.
5fb5a717deff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8509
diff changeset
   134
        (sigh)
6430
9a1580465dd2 better impl. of #deferAfter:
Claus Gittinger <cg@exept.de>
parents: 6426
diff changeset
   135
9a1580465dd2 better impl. of #deferAfter:
Claus Gittinger <cg@exept.de>
parents: 6426
diff changeset
   136
    all of the 3 messages above come in various flavours:
8617
5fb5a717deff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8509
diff changeset
   137
        raiseXXX                - do not pass any additional parameter;
5fb5a717deff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8509
diff changeset
   138
                                  default messageText
5fb5a717deff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8509
diff changeset
   139
5fb5a717deff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8509
diff changeset
   140
        raiseXXXWith:           - pass additional parameter;
5fb5a717deff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8509
diff changeset
   141
                                  default messageText
5fb5a717deff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8509
diff changeset
   142
5fb5a717deff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8509
diff changeset
   143
        raiseXXXErrorString:    - do not pass any additional parameter;
5fb5a717deff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8509
diff changeset
   144
                                  given errorString
5fb5a717deff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8509
diff changeset
   145
5fb5a717deff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8509
diff changeset
   146
        raiseXXXWith:errorString:
5fb5a717deff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8509
diff changeset
   147
                                - pass any additional parameter;
5fb5a717deff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8509
diff changeset
   148
                                  AND given errorString
6430
9a1580465dd2 better impl. of #deferAfter:
Claus Gittinger <cg@exept.de>
parents: 6426
diff changeset
   149
9a1580465dd2 better impl. of #deferAfter:
Claus Gittinger <cg@exept.de>
parents: 6426
diff changeset
   150
4481
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   151
    [see also:]
8617
5fb5a717deff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8509
diff changeset
   152
        Signal  SignalSet QuerySignal
5fb5a717deff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8509
diff changeset
   153
        Context Block
5fb5a717deff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8509
diff changeset
   154
        Object DebugView
5fb5a717deff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8509
diff changeset
   155
        (``Exception handling and signals'': programming/exceptions.html)
4481
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   156
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   157
    [author:]
8617
5fb5a717deff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8509
diff changeset
   158
        Claus Gittinger
4481
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   159
"
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   160
!
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   161
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   162
examples
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   163
"
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   164
    Examples on Exception-raising & handling are found in the doc/coding
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   165
    section (CodingExamples).
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   166
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   167
    The emergencyHandler stuff is very useful, to prevent endUser applications
4554
db264efac2c0 Add copyright.
Stefan Vogel <sv@exept.de>
parents: 4548
diff changeset
   168
    from entering the debugger. See the examples in NoHandlerError.
4481
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   169
"
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   170
! !
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   171
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   172
!GenericException class methodsFor:'initialization'!
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   173
8617
5fb5a717deff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8509
diff changeset
   174
initialize
4519
fb4904d6787b Implement RecursiveExceptionError. as class based exception.
Stefan Vogel <sv@exept.de>
parents: 4517
diff changeset
   175
    NotifierString := 'unknown exception'.
15636
b9f4e2491f51 class: GenericException
Stefan Vogel <sv@exept.de>
parents: 15584
diff changeset
   176
    "force strict signal checking in Smalltalk development - nobody cares otherwise"
b9f4e2491f51 class: GenericException
Stefan Vogel <sv@exept.de>
parents: 15584
diff changeset
   177
    StrictRaising := Smalltalk isStandAloneApp not.     "set to true to check whether a signal may be raised proceedable"
4519
fb4904d6787b Implement RecursiveExceptionError. as class based exception.
Stefan Vogel <sv@exept.de>
parents: 4517
diff changeset
   178
13132
b54446664905 changed: #initialize
Claus Gittinger <cg@exept.de>
parents: 13055
diff changeset
   179
    "Modified: / 04-08-1999 / 09:06:26 / stefan"
b54446664905 changed: #initialize
Claus Gittinger <cg@exept.de>
parents: 13055
diff changeset
   180
    "Modified: / 17-11-2010 / 17:53:13 / cg"
4481
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   181
! !
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   182
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   183
!GenericException class methodsFor:'instance creation'!
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   184
8487
5c9ffa3553e3 category change
Stefan Vogel <sv@exept.de>
parents: 8466
diff changeset
   185
new
5c9ffa3553e3 category change
Stefan Vogel <sv@exept.de>
parents: 8466
diff changeset
   186
    "{ Pragma: +inlineNew }"
5c9ffa3553e3 category change
Stefan Vogel <sv@exept.de>
parents: 8466
diff changeset
   187
16190
05ae6b8316b7 class: GenericException
Claus Gittinger <cg@exept.de>
parents: 16157
diff changeset
   188
    ^ self basicNew initialize creator:self.
8487
5c9ffa3553e3 category change
Stefan Vogel <sv@exept.de>
parents: 8466
diff changeset
   189
5c9ffa3553e3 category change
Stefan Vogel <sv@exept.de>
parents: 8466
diff changeset
   190
    "Modified: / 23.7.1999 / 13:53:12 / stefan"
5c9ffa3553e3 category change
Stefan Vogel <sv@exept.de>
parents: 8466
diff changeset
   191
    "Created: / 24.7.1999 / 13:21:13 / stefan"
5c9ffa3553e3 category change
Stefan Vogel <sv@exept.de>
parents: 8466
diff changeset
   192
!
5c9ffa3553e3 category change
Stefan Vogel <sv@exept.de>
parents: 8466
diff changeset
   193
5c9ffa3553e3 category change
Stefan Vogel <sv@exept.de>
parents: 8466
diff changeset
   194
newException
8684
9c00854305f7 QuerySignal generates Notifications instead of Exceptions.
Stefan Vogel <sv@exept.de>
parents: 8681
diff changeset
   195
    "{ Pragma: +inlineNew }"
8487
5c9ffa3553e3 category change
Stefan Vogel <sv@exept.de>
parents: 8466
diff changeset
   196
16190
05ae6b8316b7 class: GenericException
Claus Gittinger <cg@exept.de>
parents: 16157
diff changeset
   197
    ^ self basicNew initialize creator:self.
8487
5c9ffa3553e3 category change
Stefan Vogel <sv@exept.de>
parents: 8466
diff changeset
   198
5c9ffa3553e3 category change
Stefan Vogel <sv@exept.de>
parents: 8466
diff changeset
   199
    "Created: / 23.7.1999 / 13:45:49 / stefan"
5c9ffa3553e3 category change
Stefan Vogel <sv@exept.de>
parents: 8466
diff changeset
   200
    "Modified: / 24.7.1999 / 13:21:25 / stefan"
4481
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   201
! !
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   202
14962
2d0932f775a2 class: GenericException
Claus Gittinger <cg@exept.de>
parents: 14241
diff changeset
   203
15123
aa1c95f7808c class: GenericException
Claus Gittinger <cg@exept.de>
parents: 15101
diff changeset
   204
!GenericException class methodsFor:'Compatibility-ANSI'!
10189
2488a51f8d99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9992
diff changeset
   205
2488a51f8d99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9992
diff changeset
   206
signal
2488a51f8d99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9992
diff changeset
   207
    "raise a signal proceedable or nonproceedable (whichever is right).
15123
aa1c95f7808c class: GenericException
Claus Gittinger <cg@exept.de>
parents: 15101
diff changeset
   208
     ANSI compatibility."
10189
2488a51f8d99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9992
diff changeset
   209
2488a51f8d99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9992
diff changeset
   210
    ^ self raiseSignal
2488a51f8d99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9992
diff changeset
   211
2488a51f8d99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9992
diff changeset
   212
    "Created: / 20-11-2006 / 14:00:09 / cg"
15123
aa1c95f7808c class: GenericException
Claus Gittinger <cg@exept.de>
parents: 15101
diff changeset
   213
!
aa1c95f7808c class: GenericException
Claus Gittinger <cg@exept.de>
parents: 15101
diff changeset
   214
aa1c95f7808c class: GenericException
Claus Gittinger <cg@exept.de>
parents: 15101
diff changeset
   215
signalWith:messageText
aa1c95f7808c class: GenericException
Claus Gittinger <cg@exept.de>
parents: 15101
diff changeset
   216
    "raise a signal proceedable or nonproceedable (whichever is right).
aa1c95f7808c class: GenericException
Claus Gittinger <cg@exept.de>
parents: 15101
diff changeset
   217
     The argument is used as messageText.
aa1c95f7808c class: GenericException
Claus Gittinger <cg@exept.de>
parents: 15101
diff changeset
   218
     ANSI compatibility."
aa1c95f7808c class: GenericException
Claus Gittinger <cg@exept.de>
parents: 15101
diff changeset
   219
aa1c95f7808c class: GenericException
Claus Gittinger <cg@exept.de>
parents: 15101
diff changeset
   220
    <resource: #skipInDebuggersWalkBack>
aa1c95f7808c class: GenericException
Claus Gittinger <cg@exept.de>
parents: 15101
diff changeset
   221
aa1c95f7808c class: GenericException
Claus Gittinger <cg@exept.de>
parents: 15101
diff changeset
   222
    self raiseErrorString:messageText
10189
2488a51f8d99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9992
diff changeset
   223
! !
2488a51f8d99 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9992
diff changeset
   224
16248
933761e57891 class: GenericException
Stefan Vogel <sv@exept.de>
parents: 16224
diff changeset
   225
4562
2cd0c20d8970 Add #description, #creator
Stefan Vogel <sv@exept.de>
parents: 4556
diff changeset
   226
!GenericException class methodsFor:'accessing'!
2cd0c20d8970 Add #description, #creator
Stefan Vogel <sv@exept.de>
parents: 4556
diff changeset
   227
4481
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   228
errorString
4562
2cd0c20d8970 Add #description, #creator
Stefan Vogel <sv@exept.de>
parents: 4556
diff changeset
   229
    "#errorString is deprecated, use description instead"
4481
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   230
6859
5ef85865e8db Print exception description with #printOn:
Stefan Vogel <sv@exept.de>
parents: 6630
diff changeset
   231
    <resource:#obsolete>
5ef85865e8db Print exception description with #printOn:
Stefan Vogel <sv@exept.de>
parents: 6630
diff changeset
   232
4562
2cd0c20d8970 Add #description, #creator
Stefan Vogel <sv@exept.de>
parents: 4556
diff changeset
   233
    ^ self description
4481
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   234
!
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   235
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   236
handlerBlock
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   237
    "Compatibility with Signal. Class based exeptions do not have a handler
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   238
     block. They redefine the #action method instead"
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   239
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   240
    ^ nil
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   241
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   242
    "Created: / 23.7.1999 / 14:43:18 / stefan"
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   243
    "Modified: / 24.7.1999 / 20:52:10 / stefan"
8677
d09ee4c45c17 categories and comments
Stefan Vogel <sv@exept.de>
parents: 8617
diff changeset
   244
!
d09ee4c45c17 categories and comments
Stefan Vogel <sv@exept.de>
parents: 8617
diff changeset
   245
d09ee4c45c17 categories and comments
Stefan Vogel <sv@exept.de>
parents: 8617
diff changeset
   246
notifierString:aString
d09ee4c45c17 categories and comments
Stefan Vogel <sv@exept.de>
parents: 8617
diff changeset
   247
d09ee4c45c17 categories and comments
Stefan Vogel <sv@exept.de>
parents: 8617
diff changeset
   248
    NotifierString := aString
4481
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   249
! !
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   250
8677
d09ee4c45c17 categories and comments
Stefan Vogel <sv@exept.de>
parents: 8617
diff changeset
   251
!GenericException class methodsFor:'backward compatibility'!
d09ee4c45c17 categories and comments
Stefan Vogel <sv@exept.de>
parents: 8617
diff changeset
   252
d09ee4c45c17 categories and comments
Stefan Vogel <sv@exept.de>
parents: 8617
diff changeset
   253
abortingEmergencyHandler
d09ee4c45c17 categories and comments
Stefan Vogel <sv@exept.de>
parents: 8617
diff changeset
   254
    "WARNING: this method belongs to NoHandlerError, and has been moved there"
d09ee4c45c17 categories and comments
Stefan Vogel <sv@exept.de>
parents: 8617
diff changeset
   255
    <resource: #obsolete>
d09ee4c45c17 categories and comments
Stefan Vogel <sv@exept.de>
parents: 8617
diff changeset
   256
d09ee4c45c17 categories and comments
Stefan Vogel <sv@exept.de>
parents: 8617
diff changeset
   257
    ^ NoHandlerError abortingEmergencyHandler
d09ee4c45c17 categories and comments
Stefan Vogel <sv@exept.de>
parents: 8617
diff changeset
   258
!
d09ee4c45c17 categories and comments
Stefan Vogel <sv@exept.de>
parents: 8617
diff changeset
   259
d09ee4c45c17 categories and comments
Stefan Vogel <sv@exept.de>
parents: 8617
diff changeset
   260
dumpingEmergencyHandler
d09ee4c45c17 categories and comments
Stefan Vogel <sv@exept.de>
parents: 8617
diff changeset
   261
    "WARNING: this method belongs to NoHandlerError, and has been moved there"
d09ee4c45c17 categories and comments
Stefan Vogel <sv@exept.de>
parents: 8617
diff changeset
   262
    <resource: #obsolete>
d09ee4c45c17 categories and comments
Stefan Vogel <sv@exept.de>
parents: 8617
diff changeset
   263
d09ee4c45c17 categories and comments
Stefan Vogel <sv@exept.de>
parents: 8617
diff changeset
   264
    ^ NoHandlerError dumpingEmergencyHandler
d09ee4c45c17 categories and comments
Stefan Vogel <sv@exept.de>
parents: 8617
diff changeset
   265
!
4562
2cd0c20d8970 Add #description, #creator
Stefan Vogel <sv@exept.de>
parents: 4556
diff changeset
   266
2cd0c20d8970 Add #description, #creator
Stefan Vogel <sv@exept.de>
parents: 4556
diff changeset
   267
emergencyHandler
8677
d09ee4c45c17 categories and comments
Stefan Vogel <sv@exept.de>
parents: 8617
diff changeset
   268
    "WARNING: this method belongs to NoHandlerError, and has been moved there"
d09ee4c45c17 categories and comments
Stefan Vogel <sv@exept.de>
parents: 8617
diff changeset
   269
    <resource: #obsolete>
4562
2cd0c20d8970 Add #description, #creator
Stefan Vogel <sv@exept.de>
parents: 4556
diff changeset
   270
2cd0c20d8970 Add #description, #creator
Stefan Vogel <sv@exept.de>
parents: 4556
diff changeset
   271
    ^ NoHandlerError emergencyHandler.
2cd0c20d8970 Add #description, #creator
Stefan Vogel <sv@exept.de>
parents: 4556
diff changeset
   272
!
2cd0c20d8970 Add #description, #creator
Stefan Vogel <sv@exept.de>
parents: 4556
diff changeset
   273
2cd0c20d8970 Add #description, #creator
Stefan Vogel <sv@exept.de>
parents: 4556
diff changeset
   274
emergencyHandler:aOneArgBlock
8677
d09ee4c45c17 categories and comments
Stefan Vogel <sv@exept.de>
parents: 8617
diff changeset
   275
    "WARNING: this method belongs to NoHandlerError, and has been moved there"
d09ee4c45c17 categories and comments
Stefan Vogel <sv@exept.de>
parents: 8617
diff changeset
   276
    <resource: #obsolete>
d09ee4c45c17 categories and comments
Stefan Vogel <sv@exept.de>
parents: 8617
diff changeset
   277
d09ee4c45c17 categories and comments
Stefan Vogel <sv@exept.de>
parents: 8617
diff changeset
   278
    ^ NoHandlerError emergencyHandler:aOneArgBlock
d09ee4c45c17 categories and comments
Stefan Vogel <sv@exept.de>
parents: 8617
diff changeset
   279
!
d09ee4c45c17 categories and comments
Stefan Vogel <sv@exept.de>
parents: 8617
diff changeset
   280
d09ee4c45c17 categories and comments
Stefan Vogel <sv@exept.de>
parents: 8617
diff changeset
   281
mailingEmergencyHandler
d09ee4c45c17 categories and comments
Stefan Vogel <sv@exept.de>
parents: 8617
diff changeset
   282
    "WARNING: this method belongs to NoHandlerError, and has been moved there"
d09ee4c45c17 categories and comments
Stefan Vogel <sv@exept.de>
parents: 8617
diff changeset
   283
    <resource: #obsolete>
d09ee4c45c17 categories and comments
Stefan Vogel <sv@exept.de>
parents: 8617
diff changeset
   284
d09ee4c45c17 categories and comments
Stefan Vogel <sv@exept.de>
parents: 8617
diff changeset
   285
    ^ NoHandlerError mailingEmergencyHandler
d09ee4c45c17 categories and comments
Stefan Vogel <sv@exept.de>
parents: 8617
diff changeset
   286
!
d09ee4c45c17 categories and comments
Stefan Vogel <sv@exept.de>
parents: 8617
diff changeset
   287
d09ee4c45c17 categories and comments
Stefan Vogel <sv@exept.de>
parents: 8617
diff changeset
   288
notifyingEmergencyHandler
d09ee4c45c17 categories and comments
Stefan Vogel <sv@exept.de>
parents: 8617
diff changeset
   289
    "WARNING: this method belongs to NoHandlerError, and has been moved there"
d09ee4c45c17 categories and comments
Stefan Vogel <sv@exept.de>
parents: 8617
diff changeset
   290
    <resource: #obsolete>
d09ee4c45c17 categories and comments
Stefan Vogel <sv@exept.de>
parents: 8617
diff changeset
   291
d09ee4c45c17 categories and comments
Stefan Vogel <sv@exept.de>
parents: 8617
diff changeset
   292
    ^ NoHandlerError notifyingEmergencyHandler
d09ee4c45c17 categories and comments
Stefan Vogel <sv@exept.de>
parents: 8617
diff changeset
   293
!
4562
2cd0c20d8970 Add #description, #creator
Stefan Vogel <sv@exept.de>
parents: 4556
diff changeset
   294
8677
d09ee4c45c17 categories and comments
Stefan Vogel <sv@exept.de>
parents: 8617
diff changeset
   295
notifyingEmergencyHandlerForUserProcesses
d09ee4c45c17 categories and comments
Stefan Vogel <sv@exept.de>
parents: 8617
diff changeset
   296
    "WARNING: this method belongs to NoHandlerError, and has been moved there"
d09ee4c45c17 categories and comments
Stefan Vogel <sv@exept.de>
parents: 8617
diff changeset
   297
    <resource: #obsolete>
d09ee4c45c17 categories and comments
Stefan Vogel <sv@exept.de>
parents: 8617
diff changeset
   298
d09ee4c45c17 categories and comments
Stefan Vogel <sv@exept.de>
parents: 8617
diff changeset
   299
    ^ NoHandlerError notifyingEmergencyHandlerForUserProcesses
d09ee4c45c17 categories and comments
Stefan Vogel <sv@exept.de>
parents: 8617
diff changeset
   300
! !
d09ee4c45c17 categories and comments
Stefan Vogel <sv@exept.de>
parents: 8617
diff changeset
   301
d09ee4c45c17 categories and comments
Stefan Vogel <sv@exept.de>
parents: 8617
diff changeset
   302
!GenericException class methodsFor:'child signal creation'!
4562
2cd0c20d8970 Add #description, #creator
Stefan Vogel <sv@exept.de>
parents: 4556
diff changeset
   303
8677
d09ee4c45c17 categories and comments
Stefan Vogel <sv@exept.de>
parents: 8617
diff changeset
   304
newSignal
d09ee4c45c17 categories and comments
Stefan Vogel <sv@exept.de>
parents: 8617
diff changeset
   305
    "create a new signal, using the receiver as a prototype and
d09ee4c45c17 categories and comments
Stefan Vogel <sv@exept.de>
parents: 8617
diff changeset
   306
     setting the parent of the new signal to the receiver."
d09ee4c45c17 categories and comments
Stefan Vogel <sv@exept.de>
parents: 8617
diff changeset
   307
d09ee4c45c17 categories and comments
Stefan Vogel <sv@exept.de>
parents: 8617
diff changeset
   308
    ^ self newSignalMayProceed:self mayProceed
d09ee4c45c17 categories and comments
Stefan Vogel <sv@exept.de>
parents: 8617
diff changeset
   309
d09ee4c45c17 categories and comments
Stefan Vogel <sv@exept.de>
parents: 8617
diff changeset
   310
    "Created: / 23.7.1999 / 20:13:23 / stefan"
d09ee4c45c17 categories and comments
Stefan Vogel <sv@exept.de>
parents: 8617
diff changeset
   311
!
d09ee4c45c17 categories and comments
Stefan Vogel <sv@exept.de>
parents: 8617
diff changeset
   312
d09ee4c45c17 categories and comments
Stefan Vogel <sv@exept.de>
parents: 8617
diff changeset
   313
newSignalMayProceed:mayProceedBoolean
d09ee4c45c17 categories and comments
Stefan Vogel <sv@exept.de>
parents: 8617
diff changeset
   314
    "create a new signal, using the receiver as a prototype and
d09ee4c45c17 categories and comments
Stefan Vogel <sv@exept.de>
parents: 8617
diff changeset
   315
     setting the parent of the new signal to the receiver."
d09ee4c45c17 categories and comments
Stefan Vogel <sv@exept.de>
parents: 8617
diff changeset
   316
d09ee4c45c17 categories and comments
Stefan Vogel <sv@exept.de>
parents: 8617
diff changeset
   317
    |sig|
4562
2cd0c20d8970 Add #description, #creator
Stefan Vogel <sv@exept.de>
parents: 4556
diff changeset
   318
8677
d09ee4c45c17 categories and comments
Stefan Vogel <sv@exept.de>
parents: 8617
diff changeset
   319
    self isQuerySignal ifTrue:[
d09ee4c45c17 categories and comments
Stefan Vogel <sv@exept.de>
parents: 8617
diff changeset
   320
        sig := QuerySignal basicNew.
d09ee4c45c17 categories and comments
Stefan Vogel <sv@exept.de>
parents: 8617
diff changeset
   321
        mayProceedBoolean ifFalse:[
8681
38aa963476a5 Support for Block>>#on:do:on:do:
Stefan Vogel <sv@exept.de>
parents: 8677
diff changeset
   322
            'Exception [warning]: nonProceedable queries do not make sense' infoPrintCR.
8677
d09ee4c45c17 categories and comments
Stefan Vogel <sv@exept.de>
parents: 8617
diff changeset
   323
        ].
d09ee4c45c17 categories and comments
Stefan Vogel <sv@exept.de>
parents: 8617
diff changeset
   324
    ] ifFalse:[
d09ee4c45c17 categories and comments
Stefan Vogel <sv@exept.de>
parents: 8617
diff changeset
   325
        sig := Signal basicNew.
d09ee4c45c17 categories and comments
Stefan Vogel <sv@exept.de>
parents: 8617
diff changeset
   326
    ].
d09ee4c45c17 categories and comments
Stefan Vogel <sv@exept.de>
parents: 8617
diff changeset
   327
    ^ sig
d09ee4c45c17 categories and comments
Stefan Vogel <sv@exept.de>
parents: 8617
diff changeset
   328
        mayProceed:mayProceedBoolean;
d09ee4c45c17 categories and comments
Stefan Vogel <sv@exept.de>
parents: 8617
diff changeset
   329
        notifierString:NotifierString;
d09ee4c45c17 categories and comments
Stefan Vogel <sv@exept.de>
parents: 8617
diff changeset
   330
        parent:self
d09ee4c45c17 categories and comments
Stefan Vogel <sv@exept.de>
parents: 8617
diff changeset
   331
d09ee4c45c17 categories and comments
Stefan Vogel <sv@exept.de>
parents: 8617
diff changeset
   332
    "Created: / 23.7.1999 / 20:12:43 / stefan"
d09ee4c45c17 categories and comments
Stefan Vogel <sv@exept.de>
parents: 8617
diff changeset
   333
! !
d09ee4c45c17 categories and comments
Stefan Vogel <sv@exept.de>
parents: 8617
diff changeset
   334
d09ee4c45c17 categories and comments
Stefan Vogel <sv@exept.de>
parents: 8617
diff changeset
   335
!GenericException class methodsFor:'converting'!
d09ee4c45c17 categories and comments
Stefan Vogel <sv@exept.de>
parents: 8617
diff changeset
   336
d09ee4c45c17 categories and comments
Stefan Vogel <sv@exept.de>
parents: 8617
diff changeset
   337
, anExceptionHandler
d09ee4c45c17 categories and comments
Stefan Vogel <sv@exept.de>
parents: 8617
diff changeset
   338
    "return a SignalSet with myself and anExceptionHandler"
4562
2cd0c20d8970 Add #description, #creator
Stefan Vogel <sv@exept.de>
parents: 4556
diff changeset
   339
8677
d09ee4c45c17 categories and comments
Stefan Vogel <sv@exept.de>
parents: 8617
diff changeset
   340
    ^ SignalSet with:self with:anExceptionHandler
d09ee4c45c17 categories and comments
Stefan Vogel <sv@exept.de>
parents: 8617
diff changeset
   341
! !
d09ee4c45c17 categories and comments
Stefan Vogel <sv@exept.de>
parents: 8617
diff changeset
   342
12085
3f2177e11a8a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12059
diff changeset
   343
!GenericException class methodsFor:'misc ui support'!
3f2177e11a8a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12059
diff changeset
   344
3f2177e11a8a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12059
diff changeset
   345
iconInBrowserSymbol
3f2177e11a8a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12059
diff changeset
   346
    <resource: #programImage>
3f2177e11a8a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12059
diff changeset
   347
3f2177e11a8a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12059
diff changeset
   348
    ^ #exceptionClassBrowserIcon
3f2177e11a8a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12059
diff changeset
   349
! !
3f2177e11a8a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12059
diff changeset
   350
8677
d09ee4c45c17 categories and comments
Stefan Vogel <sv@exept.de>
parents: 8617
diff changeset
   351
!GenericException class methodsFor:'printing'!
d09ee4c45c17 categories and comments
Stefan Vogel <sv@exept.de>
parents: 8617
diff changeset
   352
d09ee4c45c17 categories and comments
Stefan Vogel <sv@exept.de>
parents: 8617
diff changeset
   353
description
d09ee4c45c17 categories and comments
Stefan Vogel <sv@exept.de>
parents: 8617
diff changeset
   354
    "return the notifier string.
d09ee4c45c17 categories and comments
Stefan Vogel <sv@exept.de>
parents: 8617
diff changeset
   355
     If the notifier string starts with space, prepend
d09ee4c45c17 categories and comments
Stefan Vogel <sv@exept.de>
parents: 8617
diff changeset
   356
     the parents notifier string.
d09ee4c45c17 categories and comments
Stefan Vogel <sv@exept.de>
parents: 8617
diff changeset
   357
     Subclasses may redefine this method."
d09ee4c45c17 categories and comments
Stefan Vogel <sv@exept.de>
parents: 8617
diff changeset
   358
d09ee4c45c17 categories and comments
Stefan Vogel <sv@exept.de>
parents: 8617
diff changeset
   359
    |parent|
4562
2cd0c20d8970 Add #description, #creator
Stefan Vogel <sv@exept.de>
parents: 4556
diff changeset
   360
8677
d09ee4c45c17 categories and comments
Stefan Vogel <sv@exept.de>
parents: 8617
diff changeset
   361
    NotifierString isNil ifTrue:[
13305
8734f4b61c44 added: #nameForDescription
Claus Gittinger <cg@exept.de>
parents: 13248
diff changeset
   362
        ^ self nameForDescription asString
8677
d09ee4c45c17 categories and comments
Stefan Vogel <sv@exept.de>
parents: 8617
diff changeset
   363
    ].
d09ee4c45c17 categories and comments
Stefan Vogel <sv@exept.de>
parents: 8617
diff changeset
   364
    (NotifierString startsWith:Character space) ifTrue:[
d09ee4c45c17 categories and comments
Stefan Vogel <sv@exept.de>
parents: 8617
diff changeset
   365
        (parent := self parent) notNil ifTrue:[
d09ee4c45c17 categories and comments
Stefan Vogel <sv@exept.de>
parents: 8617
diff changeset
   366
            ^ parent description, NotifierString
d09ee4c45c17 categories and comments
Stefan Vogel <sv@exept.de>
parents: 8617
diff changeset
   367
        ].
d09ee4c45c17 categories and comments
Stefan Vogel <sv@exept.de>
parents: 8617
diff changeset
   368
    ].
d09ee4c45c17 categories and comments
Stefan Vogel <sv@exept.de>
parents: 8617
diff changeset
   369
    ^ NotifierString
d09ee4c45c17 categories and comments
Stefan Vogel <sv@exept.de>
parents: 8617
diff changeset
   370
d09ee4c45c17 categories and comments
Stefan Vogel <sv@exept.de>
parents: 8617
diff changeset
   371
    "
d09ee4c45c17 categories and comments
Stefan Vogel <sv@exept.de>
parents: 8617
diff changeset
   372
     Object errorSignal description
4562
2cd0c20d8970 Add #description, #creator
Stefan Vogel <sv@exept.de>
parents: 4556
diff changeset
   373
    "
2cd0c20d8970 Add #description, #creator
Stefan Vogel <sv@exept.de>
parents: 4556
diff changeset
   374
13305
8734f4b61c44 added: #nameForDescription
Claus Gittinger <cg@exept.de>
parents: 13248
diff changeset
   375
    "Created: / 23-07-1999 / 14:22:25 / stefan"
8734f4b61c44 added: #nameForDescription
Claus Gittinger <cg@exept.de>
parents: 13248
diff changeset
   376
    "Modified: / 10-02-2011 / 12:29:07 / cg"
8734f4b61c44 added: #nameForDescription
Claus Gittinger <cg@exept.de>
parents: 13248
diff changeset
   377
!
8734f4b61c44 added: #nameForDescription
Claus Gittinger <cg@exept.de>
parents: 13248
diff changeset
   378
8734f4b61c44 added: #nameForDescription
Claus Gittinger <cg@exept.de>
parents: 13248
diff changeset
   379
nameForDescription
8734f4b61c44 added: #nameForDescription
Claus Gittinger <cg@exept.de>
parents: 13248
diff changeset
   380
    "if no notifierString is specified, this is used.
8734f4b61c44 added: #nameForDescription
Claus Gittinger <cg@exept.de>
parents: 13248
diff changeset
   381
     Can be redfined to hide the namespace in subclasses"
8734f4b61c44 added: #nameForDescription
Claus Gittinger <cg@exept.de>
parents: 13248
diff changeset
   382
8734f4b61c44 added: #nameForDescription
Claus Gittinger <cg@exept.de>
parents: 13248
diff changeset
   383
    ^ self name
8734f4b61c44 added: #nameForDescription
Claus Gittinger <cg@exept.de>
parents: 13248
diff changeset
   384
8734f4b61c44 added: #nameForDescription
Claus Gittinger <cg@exept.de>
parents: 13248
diff changeset
   385
    "Created: / 10-02-2011 / 12:28:51 / cg"
4562
2cd0c20d8970 Add #description, #creator
Stefan Vogel <sv@exept.de>
parents: 4556
diff changeset
   386
! !
2cd0c20d8970 Add #description, #creator
Stefan Vogel <sv@exept.de>
parents: 4556
diff changeset
   387
8677
d09ee4c45c17 categories and comments
Stefan Vogel <sv@exept.de>
parents: 8617
diff changeset
   388
!GenericException class methodsFor:'queries'!
4481
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   389
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   390
accepts:aSignal
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   391
    "return true, if the receiver accepts the argument, aSignal.
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   392
     (i.e. the receiver is aSignal or a parent of it). False otherwise."
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   393
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   394
    |s|
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   395
4527
2ddbe34bab87 Make error classes public.
Stefan Vogel <sv@exept.de>
parents: 4521
diff changeset
   396
    self == aSignal ifTrue:[^ true].
4481
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   397
    aSignal isQuerySignal ifTrue:[^ false].
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   398
8681
38aa963476a5 Support for Block>>#on:do:on:do:
Stefan Vogel <sv@exept.de>
parents: 8677
diff changeset
   399
    s := aSignal parent.
4481
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   400
    [s notNil] whileTrue:[
8617
5fb5a717deff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8509
diff changeset
   401
        self == s ifTrue:[^ true].
5fb5a717deff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8509
diff changeset
   402
        s := s parent
4481
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   403
    ].
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   404
    ^ false
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   405
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   406
    "Created: / 23.7.1999 / 14:00:47 / stefan"
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   407
!
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   408
9505
468b2b966bbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9272
diff changeset
   409
exception:anException isHandledIn:aContext
468b2b966bbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9272
diff changeset
   410
    "return true, if there is a handler for anException in the
4676
5d469e2da40a common code for isHandled
Claus Gittinger <cg@exept.de>
parents: 4632
diff changeset
   411
     contextChain starting with aContext."
5d469e2da40a common code for isHandled
Claus Gittinger <cg@exept.de>
parents: 4632
diff changeset
   412
9505
468b2b966bbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9272
diff changeset
   413
    ^ (self handlerContextForException:anException in:aContext) notNil
468b2b966bbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9272
diff changeset
   414
!
468b2b966bbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9272
diff changeset
   415
468b2b966bbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9272
diff changeset
   416
exceptionHandlerFor:anException in:aContext
468b2b966bbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9272
diff changeset
   417
    "answer the exceptionHandler-block for anException from aContext."
468b2b966bbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9272
diff changeset
   418
468b2b966bbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9272
diff changeset
   419
    |sel|
468b2b966bbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9272
diff changeset
   420
468b2b966bbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9272
diff changeset
   421
    sel := aContext selector.
468b2b966bbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9272
diff changeset
   422
    (sel == #'handle:from:do:'
468b2b966bbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9272
diff changeset
   423
     or:[sel == #'handle:do:']) ifTrue:[
468b2b966bbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9272
diff changeset
   424
        ^ aContext receiver
468b2b966bbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9272
diff changeset
   425
    ].
468b2b966bbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9272
diff changeset
   426
468b2b966bbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9272
diff changeset
   427
    ^ nil
468b2b966bbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9272
diff changeset
   428
!
468b2b966bbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9272
diff changeset
   429
468b2b966bbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9272
diff changeset
   430
handlerContextForException:anException in:aContext
468b2b966bbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9272
diff changeset
   431
    "return a handlerContext for anException in the
468b2b966bbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9272
diff changeset
   432
     contextChain starting with aContext. 
14085
aea63f5d809c changed comment: #handlerContextForException:in:
Stefan Vogel <sv@exept.de>
parents: 13803
diff changeset
   433
     Returns nil, if there is no handler."
9505
468b2b966bbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9272
diff changeset
   434
468b2b966bbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9272
diff changeset
   435
    |theContext ex1 con1|
8313
2aa626e8e404 Fix do not execute an exception handler inside the do-block, when the
Stefan Vogel <sv@exept.de>
parents: 8254
diff changeset
   436
2aa626e8e404 Fix do not execute an exception handler inside the do-block, when the
Stefan Vogel <sv@exept.de>
parents: 8254
diff changeset
   437
    theContext := aContext findExceptional.
2aa626e8e404 Fix do not execute an exception handler inside the do-block, when the
Stefan Vogel <sv@exept.de>
parents: 8254
diff changeset
   438
    [theContext notNil] whileTrue:[
9505
468b2b966bbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9272
diff changeset
   439
        theContext isRaiseContext ifTrue:[ 
8313
2aa626e8e404 Fix do not execute an exception handler inside the do-block, when the
Stefan Vogel <sv@exept.de>
parents: 8254
diff changeset
   440
            "skip all the contexts between the raise and the sender of #handle:do"
2aa626e8e404 Fix do not execute an exception handler inside the do-block, when the
Stefan Vogel <sv@exept.de>
parents: 8254
diff changeset
   441
            ex1 := theContext receiver.              "exception, that has been raised"
2aa626e8e404 Fix do not execute an exception handler inside the do-block, when the
Stefan Vogel <sv@exept.de>
parents: 8254
diff changeset
   442
            con1 := ex1 handlerContext.              "the context of the #handle:do:"
2aa626e8e404 Fix do not execute an exception handler inside the do-block, when the
Stefan Vogel <sv@exept.de>
parents: 8254
diff changeset
   443
            con1 notNil ifTrue:[
2aa626e8e404 Fix do not execute an exception handler inside the do-block, when the
Stefan Vogel <sv@exept.de>
parents: 8254
diff changeset
   444
                "handlerContext may be nil, if this is a default action"
2aa626e8e404 Fix do not execute an exception handler inside the do-block, when the
Stefan Vogel <sv@exept.de>
parents: 8254
diff changeset
   445
                theContext := con1.
2aa626e8e404 Fix do not execute an exception handler inside the do-block, when the
Stefan Vogel <sv@exept.de>
parents: 8254
diff changeset
   446
            ].
2aa626e8e404 Fix do not execute an exception handler inside the do-block, when the
Stefan Vogel <sv@exept.de>
parents: 8254
diff changeset
   447
            ex1 := con1 := nil.
2aa626e8e404 Fix do not execute an exception handler inside the do-block, when the
Stefan Vogel <sv@exept.de>
parents: 8254
diff changeset
   448
        ] ifFalse:[ |r|
2aa626e8e404 Fix do not execute an exception handler inside the do-block, when the
Stefan Vogel <sv@exept.de>
parents: 8254
diff changeset
   449
            ((r := theContext receiver) notNil
9505
468b2b966bbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9272
diff changeset
   450
             and:[(r handlerForSignal:anException context:theContext originator:nil) notNil]
8313
2aa626e8e404 Fix do not execute an exception handler inside the do-block, when the
Stefan Vogel <sv@exept.de>
parents: 8254
diff changeset
   451
            ) ifTrue:[
2aa626e8e404 Fix do not execute an exception handler inside the do-block, when the
Stefan Vogel <sv@exept.de>
parents: 8254
diff changeset
   452
                "found a handler context"
9505
468b2b966bbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9272
diff changeset
   453
                ^ theContext
8313
2aa626e8e404 Fix do not execute an exception handler inside the do-block, when the
Stefan Vogel <sv@exept.de>
parents: 8254
diff changeset
   454
            ].
2aa626e8e404 Fix do not execute an exception handler inside the do-block, when the
Stefan Vogel <sv@exept.de>
parents: 8254
diff changeset
   455
        ].
2aa626e8e404 Fix do not execute an exception handler inside the do-block, when the
Stefan Vogel <sv@exept.de>
parents: 8254
diff changeset
   456
        theContext notNil ifTrue:[
2aa626e8e404 Fix do not execute an exception handler inside the do-block, when the
Stefan Vogel <sv@exept.de>
parents: 8254
diff changeset
   457
            theContext := theContext findSpecialHandle:true raise:true.
2aa626e8e404 Fix do not execute an exception handler inside the do-block, when the
Stefan Vogel <sv@exept.de>
parents: 8254
diff changeset
   458
        ].
4676
5d469e2da40a common code for isHandled
Claus Gittinger <cg@exept.de>
parents: 4632
diff changeset
   459
    ].
8313
2aa626e8e404 Fix do not execute an exception handler inside the do-block, when the
Stefan Vogel <sv@exept.de>
parents: 8254
diff changeset
   460
8681
38aa963476a5 Support for Block>>#on:do:on:do:
Stefan Vogel <sv@exept.de>
parents: 8677
diff changeset
   461
    ^ nil
38aa963476a5 Support for Block>>#on:do:on:do:
Stefan Vogel <sv@exept.de>
parents: 8677
diff changeset
   462
!
38aa963476a5 Support for Block>>#on:do:on:do:
Stefan Vogel <sv@exept.de>
parents: 8677
diff changeset
   463
4481
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   464
handlerForSignal:signal context:theContext originator:originator
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   465
    "answer the handler block for the signal from originator.
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   466
     The block is retrieved from aContext.
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   467
     Answer nil if the signal is not handled"
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   468
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   469
    (theContext selector ~~ #'handle:from:do:'
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   470
     or:[(theContext argAt:2) == originator]) ifTrue:[
8617
5fb5a717deff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8509
diff changeset
   471
        (self == signal or:[self accepts:signal]) ifTrue:[
11640
2df4e81e1dbd changed #handlerForSignal:context:originator:
Stefan Vogel <sv@exept.de>
parents: 11621
diff changeset
   472
            ^ (theContext argAt:1) ? [nil]
8617
5fb5a717deff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8509
diff changeset
   473
        ]
4481
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   474
    ].
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   475
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   476
    ^ nil
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   477
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   478
    "Created: / 25.7.1999 / 19:52:58 / stefan"
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   479
!
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   480
4544
2a0e3853d320 #returnDoing works for any exception handler.
Stefan Vogel <sv@exept.de>
parents: 4538
diff changeset
   481
handlerProtectedBlock:doBlock inContext:context
2a0e3853d320 #returnDoing works for any exception handler.
Stefan Vogel <sv@exept.de>
parents: 4538
diff changeset
   482
    "set the handlerProtectedBlock in context"
2a0e3853d320 #returnDoing works for any exception handler.
Stefan Vogel <sv@exept.de>
parents: 4538
diff changeset
   483
5590
e85d241c7a36 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5570
diff changeset
   484
    |sel|
e85d241c7a36 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5570
diff changeset
   485
e85d241c7a36 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5570
diff changeset
   486
    sel := context selector.
e85d241c7a36 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5570
diff changeset
   487
    sel == #handle:do: ifTrue:[
8617
5fb5a717deff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8509
diff changeset
   488
        context argAt:2 put:doBlock.
5590
e85d241c7a36 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5570
diff changeset
   489
    ] ifFalse:[sel == #handle:from:do: ifTrue:[
8617
5fb5a717deff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8509
diff changeset
   490
        context argAt:3 put:doBlock.
4544
2a0e3853d320 #returnDoing works for any exception handler.
Stefan Vogel <sv@exept.de>
parents: 4538
diff changeset
   491
    ]].
2a0e3853d320 #returnDoing works for any exception handler.
Stefan Vogel <sv@exept.de>
parents: 4538
diff changeset
   492
!
2a0e3853d320 #returnDoing works for any exception handler.
Stefan Vogel <sv@exept.de>
parents: 4538
diff changeset
   493
8681
38aa963476a5 Support for Block>>#on:do:on:do:
Stefan Vogel <sv@exept.de>
parents: 8677
diff changeset
   494
handles:anException
38aa963476a5 Support for Block>>#on:do:on:do:
Stefan Vogel <sv@exept.de>
parents: 8677
diff changeset
   495
    "return true, if the receiver handles the argument, anException.
38aa963476a5 Support for Block>>#on:do:on:do:
Stefan Vogel <sv@exept.de>
parents: 8677
diff changeset
   496
     (i.e. the receiver is anExceptions signal or a parent of it)"
38aa963476a5 Support for Block>>#on:do:on:do:
Stefan Vogel <sv@exept.de>
parents: 8677
diff changeset
   497
38aa963476a5 Support for Block>>#on:do:on:do:
Stefan Vogel <sv@exept.de>
parents: 8677
diff changeset
   498
    |signal|
38aa963476a5 Support for Block>>#on:do:on:do:
Stefan Vogel <sv@exept.de>
parents: 8677
diff changeset
   499
15123
aa1c95f7808c class: GenericException
Claus Gittinger <cg@exept.de>
parents: 15101
diff changeset
   500
    signal := anException creator.
8681
38aa963476a5 Support for Block>>#on:do:on:do:
Stefan Vogel <sv@exept.de>
parents: 8677
diff changeset
   501
38aa963476a5 Support for Block>>#on:do:on:do:
Stefan Vogel <sv@exept.de>
parents: 8677
diff changeset
   502
    self == signal ifTrue:[^ true].               "quick check"
38aa963476a5 Support for Block>>#on:do:on:do:
Stefan Vogel <sv@exept.de>
parents: 8677
diff changeset
   503
    anException isNotification ifTrue:[^ false].  "speed up queries by not traversing the parent chain"
38aa963476a5 Support for Block>>#on:do:on:do:
Stefan Vogel <sv@exept.de>
parents: 8677
diff changeset
   504
38aa963476a5 Support for Block>>#on:do:on:do:
Stefan Vogel <sv@exept.de>
parents: 8677
diff changeset
   505
    [(signal := signal parent) notNil] whileTrue:[
38aa963476a5 Support for Block>>#on:do:on:do:
Stefan Vogel <sv@exept.de>
parents: 8677
diff changeset
   506
        self == signal ifTrue:[^ true].
4481
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   507
    ].
8681
38aa963476a5 Support for Block>>#on:do:on:do:
Stefan Vogel <sv@exept.de>
parents: 8677
diff changeset
   508
    ^ false
4481
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   509
!
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   510
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   511
isHandled
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   512
    "return true, if there is a handler for the receiver signal.
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   513
     Raising an unhandled signal will usually lead into the debugger,
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   514
     but can be caught globally by setting Exceptions EmergencyHandler."
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   515
4676
5d469e2da40a common code for isHandled
Claus Gittinger <cg@exept.de>
parents: 4632
diff changeset
   516
    ^ self exception:self isHandledIn:(thisContext sender).
4481
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   517
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   518
    "Created: / 23.7.1999 / 14:03:50 / stefan"
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   519
!
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   520
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   521
isHandledIn:aContext
8617
5fb5a717deff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8509
diff changeset
   522
    "return true, if there is a handler for the receiver signal in the
4481
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   523
     contextChain starting with aContext."
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   524
4676
5d469e2da40a common code for isHandled
Claus Gittinger <cg@exept.de>
parents: 4632
diff changeset
   525
    ^ self exception:self isHandledIn:aContext
4481
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   526
!
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   527
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   528
parent
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   529
    "return the parent Signal/Exception of myself.
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   530
     Subclasses may redefine this to install themself as child of
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   531
     existing Signals."
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   532
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   533
    self == GenericException ifTrue:[
8617
5fb5a717deff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8509
diff changeset
   534
        ^ nil
4481
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   535
    ].
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   536
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   537
    ^ self superclass
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   538
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   539
    "Created: / 23.7.1999 / 14:01:29 / stefan"
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   540
    "Modified: / 23.7.1999 / 16:15:38 / stefan"
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   541
! !
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   542
8677
d09ee4c45c17 categories and comments
Stefan Vogel <sv@exept.de>
parents: 8617
diff changeset
   543
!GenericException class methodsFor:'raising'!
4481
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   544
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   545
raise
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   546
    "raise a signal nonproceedable.
8313
2aa626e8e404 Fix do not execute an exception handler inside the do-block, when the
Stefan Vogel <sv@exept.de>
parents: 8254
diff changeset
   547
     The signals notifierString is used as messageText."
4481
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   548
4556
b654bb087103 new proceed code.
Claus Gittinger <cg@exept.de>
parents: 4554
diff changeset
   549
    <context: #return>
11026
677692730f7e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10777
diff changeset
   550
    <resource: #skipInDebuggersWalkBack>
4556
b654bb087103 new proceed code.
Claus Gittinger <cg@exept.de>
parents: 4554
diff changeset
   551
13009
e068f228a24b eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents: 12940
diff changeset
   552
    ^ self basicNew
e068f228a24b eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents: 12940
diff changeset
   553
        raiseIn:thisContext sender
e068f228a24b eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents: 12940
diff changeset
   554
e068f228a24b eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents: 12940
diff changeset
   555
    "Created: / 23-07-1999 / 14:07:17 / stefan"
e068f228a24b eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents: 12940
diff changeset
   556
    "Modified: / 10-08-2010 / 09:30:42 / cg"
4481
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   557
!
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   558
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   559
raiseErrorString:aString
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   560
    "raise a signal nonproceedable.
8313
2aa626e8e404 Fix do not execute an exception handler inside the do-block, when the
Stefan Vogel <sv@exept.de>
parents: 8254
diff changeset
   561
     The argument is used as messageText."
4481
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   562
4556
b654bb087103 new proceed code.
Claus Gittinger <cg@exept.de>
parents: 4554
diff changeset
   563
    <context: #return>
11026
677692730f7e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10777
diff changeset
   564
    <resource: #skipInDebuggersWalkBack>
4556
b654bb087103 new proceed code.
Claus Gittinger <cg@exept.de>
parents: 4554
diff changeset
   565
13009
e068f228a24b eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents: 12940
diff changeset
   566
    ^ self basicNew
e068f228a24b eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents: 12940
diff changeset
   567
        raiseErrorString:aString
e068f228a24b eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents: 12940
diff changeset
   568
        in:thisContext sender
e068f228a24b eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents: 12940
diff changeset
   569
e068f228a24b eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents: 12940
diff changeset
   570
    "Created: / 23-07-1999 / 14:07:33 / stefan"
e068f228a24b eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents: 12940
diff changeset
   571
    "Modified: / 10-08-2010 / 09:34:37 / cg"
4481
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   572
!
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   573
5684
53cc1d686f03 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5680
diff changeset
   574
raiseErrorString:aString in:aContext
53cc1d686f03 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5680
diff changeset
   575
    "raise a signal nonproceedable.
8313
2aa626e8e404 Fix do not execute an exception handler inside the do-block, when the
Stefan Vogel <sv@exept.de>
parents: 8254
diff changeset
   576
     The argument is used as messageText."
5684
53cc1d686f03 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5680
diff changeset
   577
53cc1d686f03 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5680
diff changeset
   578
    <context: #return>
11026
677692730f7e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10777
diff changeset
   579
    <resource: #skipInDebuggersWalkBack>
5684
53cc1d686f03 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5680
diff changeset
   580
13009
e068f228a24b eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents: 12940
diff changeset
   581
    ^ self basicNew
e068f228a24b eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents: 12940
diff changeset
   582
        raiseErrorString:aString in:aContext
e068f228a24b eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents: 12940
diff changeset
   583
e068f228a24b eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents: 12940
diff changeset
   584
    "Created: / 23-07-1999 / 14:07:33 / stefan"
e068f228a24b eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents: 12940
diff changeset
   585
    "Modified: / 10-08-2010 / 09:35:37 / cg"
5684
53cc1d686f03 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5680
diff changeset
   586
!
53cc1d686f03 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5680
diff changeset
   587
8684
9c00854305f7 QuerySignal generates Notifications instead of Exceptions.
Stefan Vogel <sv@exept.de>
parents: 8681
diff changeset
   588
raiseFrom:something 
4481
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   589
    "raise a signal nonproceedable.
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   590
     The argument, something is passed both as parameter and originator."
8684
9c00854305f7 QuerySignal generates Notifications instead of Exceptions.
Stefan Vogel <sv@exept.de>
parents: 8681
diff changeset
   591
    
4556
b654bb087103 new proceed code.
Claus Gittinger <cg@exept.de>
parents: 4554
diff changeset
   592
    <context: #return>
11026
677692730f7e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10777
diff changeset
   593
    <resource: #skipInDebuggersWalkBack>
4556
b654bb087103 new proceed code.
Claus Gittinger <cg@exept.de>
parents: 4554
diff changeset
   594
8731
03a4fd5c394d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8691
diff changeset
   595
    ^ (self newException
03a4fd5c394d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8691
diff changeset
   596
        suspendedContext:thisContext sender parameter:something originator:something)
8684
9c00854305f7 QuerySignal generates Notifications instead of Exceptions.
Stefan Vogel <sv@exept.de>
parents: 8681
diff changeset
   597
        raise
4481
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   598
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   599
    "Modified: / 2.5.1996 / 16:36:38 / cg"
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   600
    "Modified: / 5.3.1998 / 16:49:55 / stefan"
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   601
    "Created: / 23.7.1999 / 14:07:59 / stefan"
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   602
!
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   603
14241
a00234c7342f added: #raiseIn:
Stefan Vogel <sv@exept.de>
parents: 14085
diff changeset
   604
raiseIn:aContext
a00234c7342f added: #raiseIn:
Stefan Vogel <sv@exept.de>
parents: 14085
diff changeset
   605
    "raise a signal nonproceedable.
a00234c7342f added: #raiseIn:
Stefan Vogel <sv@exept.de>
parents: 14085
diff changeset
   606
     The signals notifierString is used as messageText."
a00234c7342f added: #raiseIn:
Stefan Vogel <sv@exept.de>
parents: 14085
diff changeset
   607
a00234c7342f added: #raiseIn:
Stefan Vogel <sv@exept.de>
parents: 14085
diff changeset
   608
    <context: #return>
a00234c7342f added: #raiseIn:
Stefan Vogel <sv@exept.de>
parents: 14085
diff changeset
   609
    <resource: #skipInDebuggersWalkBack>
a00234c7342f added: #raiseIn:
Stefan Vogel <sv@exept.de>
parents: 14085
diff changeset
   610
a00234c7342f added: #raiseIn:
Stefan Vogel <sv@exept.de>
parents: 14085
diff changeset
   611
    ^ self basicNew
a00234c7342f added: #raiseIn:
Stefan Vogel <sv@exept.de>
parents: 14085
diff changeset
   612
        raiseIn:aContext
a00234c7342f added: #raiseIn:
Stefan Vogel <sv@exept.de>
parents: 14085
diff changeset
   613
a00234c7342f added: #raiseIn:
Stefan Vogel <sv@exept.de>
parents: 14085
diff changeset
   614
    "Created: / 27-01-2011 / 17:28:53 / cg"
a00234c7342f added: #raiseIn:
Stefan Vogel <sv@exept.de>
parents: 14085
diff changeset
   615
!
a00234c7342f added: #raiseIn:
Stefan Vogel <sv@exept.de>
parents: 14085
diff changeset
   616
4481
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   617
raiseRequest
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   618
    "raise a signal proceedable.
8313
2aa626e8e404 Fix do not execute an exception handler inside the do-block, when the
Stefan Vogel <sv@exept.de>
parents: 8254
diff changeset
   619
     The signals notifierString is used as messageText."
4481
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   620
4556
b654bb087103 new proceed code.
Claus Gittinger <cg@exept.de>
parents: 4554
diff changeset
   621
    <context: #return>
11026
677692730f7e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10777
diff changeset
   622
    <resource: #skipInDebuggersWalkBack>
4556
b654bb087103 new proceed code.
Claus Gittinger <cg@exept.de>
parents: 4554
diff changeset
   623
13009
e068f228a24b eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents: 12940
diff changeset
   624
    ^ self basicNew
e068f228a24b eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents: 12940
diff changeset
   625
        raiseRequestIn:thisContext sender
e068f228a24b eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents: 12940
diff changeset
   626
e068f228a24b eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents: 12940
diff changeset
   627
    "Created: / 23-07-1999 / 14:08:24 / stefan"
e068f228a24b eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents: 12940
diff changeset
   628
    "Modified: / 10-08-2010 / 09:37:06 / cg"
4481
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   629
!
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   630
4758
91b5a25f29c5 added #raiseRequestErrorString
Claus Gittinger <cg@exept.de>
parents: 4676
diff changeset
   631
raiseRequestErrorString:aString
91b5a25f29c5 added #raiseRequestErrorString
Claus Gittinger <cg@exept.de>
parents: 4676
diff changeset
   632
    "raise a signal proceedable.
8313
2aa626e8e404 Fix do not execute an exception handler inside the do-block, when the
Stefan Vogel <sv@exept.de>
parents: 8254
diff changeset
   633
     The argument, aString is used as messageText."
4758
91b5a25f29c5 added #raiseRequestErrorString
Claus Gittinger <cg@exept.de>
parents: 4676
diff changeset
   634
91b5a25f29c5 added #raiseRequestErrorString
Claus Gittinger <cg@exept.de>
parents: 4676
diff changeset
   635
    <context: #return>
11026
677692730f7e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10777
diff changeset
   636
    <resource: #skipInDebuggersWalkBack>
4758
91b5a25f29c5 added #raiseRequestErrorString
Claus Gittinger <cg@exept.de>
parents: 4676
diff changeset
   637
13009
e068f228a24b eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents: 12940
diff changeset
   638
    ^ self basicNew
e068f228a24b eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents: 12940
diff changeset
   639
        raiseRequestErrorString:aString in:thisContext sender
e068f228a24b eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents: 12940
diff changeset
   640
e068f228a24b eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents: 12940
diff changeset
   641
    "Modified: / 10-08-2010 / 09:40:38 / cg"
4758
91b5a25f29c5 added #raiseRequestErrorString
Claus Gittinger <cg@exept.de>
parents: 4676
diff changeset
   642
!
91b5a25f29c5 added #raiseRequestErrorString
Claus Gittinger <cg@exept.de>
parents: 4676
diff changeset
   643
8684
9c00854305f7 QuerySignal generates Notifications instead of Exceptions.
Stefan Vogel <sv@exept.de>
parents: 8681
diff changeset
   644
raiseRequestFrom:something 
4481
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   645
    "raise a signal proceedable.
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   646
     The argument, something is passed both as parameter and originator."
8684
9c00854305f7 QuerySignal generates Notifications instead of Exceptions.
Stefan Vogel <sv@exept.de>
parents: 8681
diff changeset
   647
    
4556
b654bb087103 new proceed code.
Claus Gittinger <cg@exept.de>
parents: 4554
diff changeset
   648
    <context: #return>
11026
677692730f7e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10777
diff changeset
   649
    <resource: #skipInDebuggersWalkBack>
4556
b654bb087103 new proceed code.
Claus Gittinger <cg@exept.de>
parents: 4554
diff changeset
   650
8731
03a4fd5c394d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8691
diff changeset
   651
    ^ (self newException
03a4fd5c394d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8691
diff changeset
   652
        suspendedContext:thisContext sender parameter:something originator:something)
8684
9c00854305f7 QuerySignal generates Notifications instead of Exceptions.
Stefan Vogel <sv@exept.de>
parents: 8681
diff changeset
   653
        raiseRequest
4481
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   654
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   655
    "Modified: / 2.5.1996 / 16:36:38 / cg"
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   656
    "Modified: / 5.3.1998 / 16:52:46 / stefan"
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   657
    "Created: / 23.7.1999 / 14:08:36 / stefan"
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   658
!
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   659
13248
c07c080d6033 added: #raiseRequestIn:
Claus Gittinger <cg@exept.de>
parents: 13132
diff changeset
   660
raiseRequestIn:aContext
c07c080d6033 added: #raiseRequestIn:
Claus Gittinger <cg@exept.de>
parents: 13132
diff changeset
   661
    "raise a signal proceedable.
c07c080d6033 added: #raiseRequestIn:
Claus Gittinger <cg@exept.de>
parents: 13132
diff changeset
   662
     The signals notifierString is used as messageText."
c07c080d6033 added: #raiseRequestIn:
Claus Gittinger <cg@exept.de>
parents: 13132
diff changeset
   663
c07c080d6033 added: #raiseRequestIn:
Claus Gittinger <cg@exept.de>
parents: 13132
diff changeset
   664
    <context: #return>
c07c080d6033 added: #raiseRequestIn:
Claus Gittinger <cg@exept.de>
parents: 13132
diff changeset
   665
    <resource: #skipInDebuggersWalkBack>
c07c080d6033 added: #raiseRequestIn:
Claus Gittinger <cg@exept.de>
parents: 13132
diff changeset
   666
c07c080d6033 added: #raiseRequestIn:
Claus Gittinger <cg@exept.de>
parents: 13132
diff changeset
   667
    ^ self basicNew
c07c080d6033 added: #raiseRequestIn:
Claus Gittinger <cg@exept.de>
parents: 13132
diff changeset
   668
        raiseRequestIn:aContext
c07c080d6033 added: #raiseRequestIn:
Claus Gittinger <cg@exept.de>
parents: 13132
diff changeset
   669
c07c080d6033 added: #raiseRequestIn:
Claus Gittinger <cg@exept.de>
parents: 13132
diff changeset
   670
    "Created: / 27-01-2011 / 17:28:53 / cg"
c07c080d6033 added: #raiseRequestIn:
Claus Gittinger <cg@exept.de>
parents: 13132
diff changeset
   671
!
c07c080d6033 added: #raiseRequestIn:
Claus Gittinger <cg@exept.de>
parents: 13132
diff changeset
   672
4481
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   673
raiseRequestWith:aParameter
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   674
    "raise a signal proceedable.
8313
2aa626e8e404 Fix do not execute an exception handler inside the do-block, when the
Stefan Vogel <sv@exept.de>
parents: 8254
diff changeset
   675
     The signals notifierString is used as messageText."
4481
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   676
4556
b654bb087103 new proceed code.
Claus Gittinger <cg@exept.de>
parents: 4554
diff changeset
   677
    <context: #return>
11026
677692730f7e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10777
diff changeset
   678
    <resource: #skipInDebuggersWalkBack>
4556
b654bb087103 new proceed code.
Claus Gittinger <cg@exept.de>
parents: 4554
diff changeset
   679
13009
e068f228a24b eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents: 12940
diff changeset
   680
    ^ self basicNew
e068f228a24b eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents: 12940
diff changeset
   681
        raiseRequestWith:aParameter in:thisContext sender
e068f228a24b eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents: 12940
diff changeset
   682
e068f228a24b eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents: 12940
diff changeset
   683
    "Created: / 23-07-1999 / 14:08:48 / stefan"
e068f228a24b eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents: 12940
diff changeset
   684
    "Modified: / 10-08-2010 / 09:57:14 / cg"
4481
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   685
!
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   686
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   687
raiseRequestWith:aParameter errorString:aString
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   688
    "raise a signal proceedable.
8313
2aa626e8e404 Fix do not execute an exception handler inside the do-block, when the
Stefan Vogel <sv@exept.de>
parents: 8254
diff changeset
   689
     The argument, aString is used as messageText."
4481
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   690
4556
b654bb087103 new proceed code.
Claus Gittinger <cg@exept.de>
parents: 4554
diff changeset
   691
    <context: #return>
11026
677692730f7e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10777
diff changeset
   692
    <resource: #skipInDebuggersWalkBack>
4556
b654bb087103 new proceed code.
Claus Gittinger <cg@exept.de>
parents: 4554
diff changeset
   693
13009
e068f228a24b eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents: 12940
diff changeset
   694
    ^ self basicNew
e068f228a24b eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents: 12940
diff changeset
   695
        raiseRequestWith:aParameter errorString:aString in:thisContext sender
e068f228a24b eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents: 12940
diff changeset
   696
e068f228a24b eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents: 12940
diff changeset
   697
    "Created: / 23-07-1999 / 14:08:57 / stefan"
e068f228a24b eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents: 12940
diff changeset
   698
    "Modified: / 10-08-2010 / 09:56:55 / cg"
4481
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   699
!
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   700
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   701
raiseRequestWith:aParameter errorString:aString in:aContext
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   702
    "raise a signal proceedable.
8313
2aa626e8e404 Fix do not execute an exception handler inside the do-block, when the
Stefan Vogel <sv@exept.de>
parents: 8254
diff changeset
   703
     The argument, aString is used as messageText.
4481
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   704
     The additional context is passed as the context responsible for the raise,
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   705
     allowing a raise to mimicri the exception happened somewhere else."
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   706
8733
953001c5c40e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8731
diff changeset
   707
    <context: #return>
11026
677692730f7e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10777
diff changeset
   708
    <resource: #skipInDebuggersWalkBack>
8733
953001c5c40e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8731
diff changeset
   709
13009
e068f228a24b eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents: 12940
diff changeset
   710
    ^ self basicNew
e068f228a24b eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents: 12940
diff changeset
   711
        raiseRequestWith:aParameter errorString:aString in:aContext
e068f228a24b eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents: 12940
diff changeset
   712
e068f228a24b eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents: 12940
diff changeset
   713
    "Created: / 23-07-1999 / 14:09:07 / stefan"
e068f228a24b eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents: 12940
diff changeset
   714
    "Modified: / 10-08-2010 / 09:56:36 / cg"
4481
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   715
!
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   716
5259
cda0ce95054d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5197
diff changeset
   717
raiseRequestWith:aParameter in:aContext
cda0ce95054d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5197
diff changeset
   718
    "raise a signal proceedable.
cda0ce95054d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5197
diff changeset
   719
     The additional context is passed as the context responsible for the raise,
cda0ce95054d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5197
diff changeset
   720
     allowing a raise to mimicri the exception happened somewhere else."
cda0ce95054d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5197
diff changeset
   721
8733
953001c5c40e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8731
diff changeset
   722
    <context: #return>
11026
677692730f7e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10777
diff changeset
   723
    <resource: #skipInDebuggersWalkBack>
8733
953001c5c40e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8731
diff changeset
   724
13009
e068f228a24b eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents: 12940
diff changeset
   725
    ^ self basicNew
e068f228a24b eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents: 12940
diff changeset
   726
        raiseRequestWith:aParameter in:aContext
e068f228a24b eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents: 12940
diff changeset
   727
e068f228a24b eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents: 12940
diff changeset
   728
    "Modified: / 10-08-2010 / 09:56:12 / cg"
5259
cda0ce95054d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5197
diff changeset
   729
!
cda0ce95054d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5197
diff changeset
   730
6174
4dd6c093ab6d +raiseSignal
Claus Gittinger <cg@exept.de>
parents: 6158
diff changeset
   731
raiseSignal
4dd6c093ab6d +raiseSignal
Claus Gittinger <cg@exept.de>
parents: 6158
diff changeset
   732
    "raise a signal (proceedable or not, whatever the proceedability is).
8313
2aa626e8e404 Fix do not execute an exception handler inside the do-block, when the
Stefan Vogel <sv@exept.de>
parents: 8254
diff changeset
   733
     The signals notifierString is used as messageText."
6174
4dd6c093ab6d +raiseSignal
Claus Gittinger <cg@exept.de>
parents: 6158
diff changeset
   734
4dd6c093ab6d +raiseSignal
Claus Gittinger <cg@exept.de>
parents: 6158
diff changeset
   735
    <context: #return>
11026
677692730f7e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10777
diff changeset
   736
    <resource: #skipInDebuggersWalkBack>
6174
4dd6c093ab6d +raiseSignal
Claus Gittinger <cg@exept.de>
parents: 6158
diff changeset
   737
8731
03a4fd5c394d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8691
diff changeset
   738
    ^ (self newException
03a4fd5c394d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8691
diff changeset
   739
        suspendedContext:thisContext sender)
8684
9c00854305f7 QuerySignal generates Notifications instead of Exceptions.
Stefan Vogel <sv@exept.de>
parents: 8681
diff changeset
   740
        raiseSignal
6174
4dd6c093ab6d +raiseSignal
Claus Gittinger <cg@exept.de>
parents: 6158
diff changeset
   741
4dd6c093ab6d +raiseSignal
Claus Gittinger <cg@exept.de>
parents: 6158
diff changeset
   742
    "Modified: / 10.11.2001 / 15:13:34 / cg"
4dd6c093ab6d +raiseSignal
Claus Gittinger <cg@exept.de>
parents: 6158
diff changeset
   743
!
4dd6c093ab6d +raiseSignal
Claus Gittinger <cg@exept.de>
parents: 6158
diff changeset
   744
8677
d09ee4c45c17 categories and comments
Stefan Vogel <sv@exept.de>
parents: 8617
diff changeset
   745
raiseSignal:errorMessage
d09ee4c45c17 categories and comments
Stefan Vogel <sv@exept.de>
parents: 8617
diff changeset
   746
    "ANSI: raise a signal (proceedable or not, whatever the proceedability is).
d09ee4c45c17 categories and comments
Stefan Vogel <sv@exept.de>
parents: 8617
diff changeset
   747
     The argument, errorMessage is used as messageText."
d09ee4c45c17 categories and comments
Stefan Vogel <sv@exept.de>
parents: 8617
diff changeset
   748
d09ee4c45c17 categories and comments
Stefan Vogel <sv@exept.de>
parents: 8617
diff changeset
   749
    <context: #return>
11026
677692730f7e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10777
diff changeset
   750
    <resource: #skipInDebuggersWalkBack>
8677
d09ee4c45c17 categories and comments
Stefan Vogel <sv@exept.de>
parents: 8617
diff changeset
   751
8731
03a4fd5c394d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8691
diff changeset
   752
    ^ (self newException
03a4fd5c394d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8691
diff changeset
   753
        suspendedContext:thisContext sender errorString:errorMessage)
8684
9c00854305f7 QuerySignal generates Notifications instead of Exceptions.
Stefan Vogel <sv@exept.de>
parents: 8681
diff changeset
   754
        raiseSignal.
8677
d09ee4c45c17 categories and comments
Stefan Vogel <sv@exept.de>
parents: 8617
diff changeset
   755
d09ee4c45c17 categories and comments
Stefan Vogel <sv@exept.de>
parents: 8617
diff changeset
   756
    "Modified: / 07-08-2004 / 19:24:00 / stefan"
d09ee4c45c17 categories and comments
Stefan Vogel <sv@exept.de>
parents: 8617
diff changeset
   757
!
d09ee4c45c17 categories and comments
Stefan Vogel <sv@exept.de>
parents: 8617
diff changeset
   758
d09ee4c45c17 categories and comments
Stefan Vogel <sv@exept.de>
parents: 8617
diff changeset
   759
raiseSignal:errorMessage with:aParameter
d09ee4c45c17 categories and comments
Stefan Vogel <sv@exept.de>
parents: 8617
diff changeset
   760
    "ANSI: raise a signal (proceedable or not, whatever the proceedability is).
d09ee4c45c17 categories and comments
Stefan Vogel <sv@exept.de>
parents: 8617
diff changeset
   761
     The argument, errorMessage is used as messageText."
d09ee4c45c17 categories and comments
Stefan Vogel <sv@exept.de>
parents: 8617
diff changeset
   762
d09ee4c45c17 categories and comments
Stefan Vogel <sv@exept.de>
parents: 8617
diff changeset
   763
    <context: #return>
11026
677692730f7e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10777
diff changeset
   764
    <resource: #skipInDebuggersWalkBack>
8677
d09ee4c45c17 categories and comments
Stefan Vogel <sv@exept.de>
parents: 8617
diff changeset
   765
8731
03a4fd5c394d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8691
diff changeset
   766
    ^ (self newException
03a4fd5c394d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8691
diff changeset
   767
        suspendedContext:thisContext sender parameter:aParameter errorString:errorMessage)
8684
9c00854305f7 QuerySignal generates Notifications instead of Exceptions.
Stefan Vogel <sv@exept.de>
parents: 8681
diff changeset
   768
        raiseSignal.
8677
d09ee4c45c17 categories and comments
Stefan Vogel <sv@exept.de>
parents: 8617
diff changeset
   769
d09ee4c45c17 categories and comments
Stefan Vogel <sv@exept.de>
parents: 8617
diff changeset
   770
    "Modified: / 07-08-2004 / 19:10:40 / stefan"
d09ee4c45c17 categories and comments
Stefan Vogel <sv@exept.de>
parents: 8617
diff changeset
   771
!
d09ee4c45c17 categories and comments
Stefan Vogel <sv@exept.de>
parents: 8617
diff changeset
   772
6430
9a1580465dd2 better impl. of #deferAfter:
Claus Gittinger <cg@exept.de>
parents: 6426
diff changeset
   773
raiseSignalErrorString:aString
9a1580465dd2 better impl. of #deferAfter:
Claus Gittinger <cg@exept.de>
parents: 6426
diff changeset
   774
    "raise a signal (proceedable or not, whatever the proceedability is).
8313
2aa626e8e404 Fix do not execute an exception handler inside the do-block, when the
Stefan Vogel <sv@exept.de>
parents: 8254
diff changeset
   775
     The argument, aString is used as messageText."
6430
9a1580465dd2 better impl. of #deferAfter:
Claus Gittinger <cg@exept.de>
parents: 6426
diff changeset
   776
9a1580465dd2 better impl. of #deferAfter:
Claus Gittinger <cg@exept.de>
parents: 6426
diff changeset
   777
    <context: #return>
11026
677692730f7e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10777
diff changeset
   778
    <resource: #skipInDebuggersWalkBack>
6430
9a1580465dd2 better impl. of #deferAfter:
Claus Gittinger <cg@exept.de>
parents: 6426
diff changeset
   779
8731
03a4fd5c394d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8691
diff changeset
   780
    ^ (self newException
03a4fd5c394d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8691
diff changeset
   781
        suspendedContext:thisContext sender errorString:aString)
8684
9c00854305f7 QuerySignal generates Notifications instead of Exceptions.
Stefan Vogel <sv@exept.de>
parents: 8681
diff changeset
   782
        raiseSignal.
6430
9a1580465dd2 better impl. of #deferAfter:
Claus Gittinger <cg@exept.de>
parents: 6426
diff changeset
   783
!
9a1580465dd2 better impl. of #deferAfter:
Claus Gittinger <cg@exept.de>
parents: 6426
diff changeset
   784
9a1580465dd2 better impl. of #deferAfter:
Claus Gittinger <cg@exept.de>
parents: 6426
diff changeset
   785
raiseSignalWith:aParameter
9a1580465dd2 better impl. of #deferAfter:
Claus Gittinger <cg@exept.de>
parents: 6426
diff changeset
   786
    "raise a signal (proceedable or not, whatever the proceedability is).
9a1580465dd2 better impl. of #deferAfter:
Claus Gittinger <cg@exept.de>
parents: 6426
diff changeset
   787
     The argument, aParameter is passed as parameter."
9a1580465dd2 better impl. of #deferAfter:
Claus Gittinger <cg@exept.de>
parents: 6426
diff changeset
   788
9a1580465dd2 better impl. of #deferAfter:
Claus Gittinger <cg@exept.de>
parents: 6426
diff changeset
   789
    <context: #return>
11026
677692730f7e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10777
diff changeset
   790
    <resource: #skipInDebuggersWalkBack>
6430
9a1580465dd2 better impl. of #deferAfter:
Claus Gittinger <cg@exept.de>
parents: 6426
diff changeset
   791
8731
03a4fd5c394d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8691
diff changeset
   792
    ^ (self newException
03a4fd5c394d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8691
diff changeset
   793
        suspendedContext:thisContext sender parameter:aParameter)
8684
9c00854305f7 QuerySignal generates Notifications instead of Exceptions.
Stefan Vogel <sv@exept.de>
parents: 8681
diff changeset
   794
        raiseSignal.
6430
9a1580465dd2 better impl. of #deferAfter:
Claus Gittinger <cg@exept.de>
parents: 6426
diff changeset
   795
!
9a1580465dd2 better impl. of #deferAfter:
Claus Gittinger <cg@exept.de>
parents: 6426
diff changeset
   796
9a1580465dd2 better impl. of #deferAfter:
Claus Gittinger <cg@exept.de>
parents: 6426
diff changeset
   797
raiseSignalWith:aParameter errorString:aString
9a1580465dd2 better impl. of #deferAfter:
Claus Gittinger <cg@exept.de>
parents: 6426
diff changeset
   798
    "raise a signal (proceedable or not, whatever the proceedability is).
8617
5fb5a717deff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8509
diff changeset
   799
     The argument, aString is used as messageText,
6430
9a1580465dd2 better impl. of #deferAfter:
Claus Gittinger <cg@exept.de>
parents: 6426
diff changeset
   800
     aParameter is passed as exception parameter."
9a1580465dd2 better impl. of #deferAfter:
Claus Gittinger <cg@exept.de>
parents: 6426
diff changeset
   801
9a1580465dd2 better impl. of #deferAfter:
Claus Gittinger <cg@exept.de>
parents: 6426
diff changeset
   802
    <context: #return>
11026
677692730f7e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10777
diff changeset
   803
    <resource: #skipInDebuggersWalkBack>
6430
9a1580465dd2 better impl. of #deferAfter:
Claus Gittinger <cg@exept.de>
parents: 6426
diff changeset
   804
8731
03a4fd5c394d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8691
diff changeset
   805
    ^ (self newException
03a4fd5c394d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8691
diff changeset
   806
        suspendedContext:thisContext sender parameter:aParameter errorString:aString)
8684
9c00854305f7 QuerySignal generates Notifications instead of Exceptions.
Stefan Vogel <sv@exept.de>
parents: 8681
diff changeset
   807
        raiseSignal.
6430
9a1580465dd2 better impl. of #deferAfter:
Claus Gittinger <cg@exept.de>
parents: 6426
diff changeset
   808
!
9a1580465dd2 better impl. of #deferAfter:
Claus Gittinger <cg@exept.de>
parents: 6426
diff changeset
   809
4481
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   810
raiseWith:aParameter
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   811
    "raise a signal nonproceedable.
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   812
     The argument, aParameter is passed as parameter."
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   813
4556
b654bb087103 new proceed code.
Claus Gittinger <cg@exept.de>
parents: 4554
diff changeset
   814
    <context: #return>
11026
677692730f7e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10777
diff changeset
   815
    <resource: #skipInDebuggersWalkBack>
4556
b654bb087103 new proceed code.
Claus Gittinger <cg@exept.de>
parents: 4554
diff changeset
   816
13009
e068f228a24b eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents: 12940
diff changeset
   817
    ^ self basicNew
e068f228a24b eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents: 12940
diff changeset
   818
        raiseWith:aParameter in:thisContext sender
e068f228a24b eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents: 12940
diff changeset
   819
e068f228a24b eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents: 12940
diff changeset
   820
    "Created: / 23-07-1999 / 14:09:27 / stefan"
e068f228a24b eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents: 12940
diff changeset
   821
    "Modified: / 10-08-2010 / 09:51:11 / cg"
4481
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   822
!
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   823
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   824
raiseWith:aParameter errorString:aString
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   825
    "raise a signal nonproceedable.
8617
5fb5a717deff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8509
diff changeset
   826
     The argument, aString is used as messageText,
6430
9a1580465dd2 better impl. of #deferAfter:
Claus Gittinger <cg@exept.de>
parents: 6426
diff changeset
   827
     aParameter is passed as exception parameter."
4481
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   828
4556
b654bb087103 new proceed code.
Claus Gittinger <cg@exept.de>
parents: 4554
diff changeset
   829
    <context: #return>
11026
677692730f7e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10777
diff changeset
   830
    <resource: #skipInDebuggersWalkBack>
4556
b654bb087103 new proceed code.
Claus Gittinger <cg@exept.de>
parents: 4554
diff changeset
   831
13009
e068f228a24b eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents: 12940
diff changeset
   832
    ^ self basicNew
e068f228a24b eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents: 12940
diff changeset
   833
          raiseWith:aParameter errorString:aString in:thisContext sender.
e068f228a24b eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents: 12940
diff changeset
   834
e068f228a24b eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents: 12940
diff changeset
   835
    "Created: / 23-07-1999 / 14:09:36 / stefan"
e068f228a24b eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents: 12940
diff changeset
   836
    "Modified: / 10-08-2010 / 09:52:59 / cg"
4481
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   837
!
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   838
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   839
raiseWith:aParameter errorString:aString in:aContext
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   840
    "raise a signal nonproceedable.
8313
2aa626e8e404 Fix do not execute an exception handler inside the do-block, when the
Stefan Vogel <sv@exept.de>
parents: 8254
diff changeset
   841
     The argument, aString is used as messageText, aParameter is passed
4481
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   842
     as exception parameter.
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   843
     The additional context is passed as the context responsible for the raise,
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   844
     allowing a raise to mimicri the exception happened somewhere else."
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   845
8733
953001c5c40e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8731
diff changeset
   846
    <context: #return>
11026
677692730f7e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10777
diff changeset
   847
    <resource: #skipInDebuggersWalkBack>
8733
953001c5c40e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8731
diff changeset
   848
13009
e068f228a24b eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents: 12940
diff changeset
   849
    ^ self basicNew
e068f228a24b eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents: 12940
diff changeset
   850
          raiseWith:aParameter errorString:aString in:aContext.
e068f228a24b eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents: 12940
diff changeset
   851
e068f228a24b eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents: 12940
diff changeset
   852
    "Created: / 23-07-1999 / 14:09:46 / stefan"
e068f228a24b eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents: 12940
diff changeset
   853
    "Modified: / 10-08-2010 / 09:52:10 / cg"
8677
d09ee4c45c17 categories and comments
Stefan Vogel <sv@exept.de>
parents: 8617
diff changeset
   854
!
d09ee4c45c17 categories and comments
Stefan Vogel <sv@exept.de>
parents: 8617
diff changeset
   855
10753
880fb25e1d3f raising
Claus Gittinger <cg@exept.de>
parents: 10737
diff changeset
   856
raiseWith:aParameter in:aContext
880fb25e1d3f raising
Claus Gittinger <cg@exept.de>
parents: 10737
diff changeset
   857
    "raise a signal nonproceedable.
880fb25e1d3f raising
Claus Gittinger <cg@exept.de>
parents: 10737
diff changeset
   858
     The argument, aParameter is passed as exception parameter.
880fb25e1d3f raising
Claus Gittinger <cg@exept.de>
parents: 10737
diff changeset
   859
     The additional context is passed as the context responsible for the raise,
880fb25e1d3f raising
Claus Gittinger <cg@exept.de>
parents: 10737
diff changeset
   860
     allowing a raise to mimicri the exception happened somewhere else."
880fb25e1d3f raising
Claus Gittinger <cg@exept.de>
parents: 10737
diff changeset
   861
880fb25e1d3f raising
Claus Gittinger <cg@exept.de>
parents: 10737
diff changeset
   862
    <context: #return>
11026
677692730f7e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10777
diff changeset
   863
    <resource: #skipInDebuggersWalkBack>
10753
880fb25e1d3f raising
Claus Gittinger <cg@exept.de>
parents: 10737
diff changeset
   864
13009
e068f228a24b eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents: 12940
diff changeset
   865
    ^ self basicNew
e068f228a24b eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents: 12940
diff changeset
   866
        raiseWith:aParameter in:aContext
e068f228a24b eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents: 12940
diff changeset
   867
e068f228a24b eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents: 12940
diff changeset
   868
    "Modified: / 10-08-2010 / 09:52:38 / cg"
4481
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   869
! !
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   870
8677
d09ee4c45c17 categories and comments
Stefan Vogel <sv@exept.de>
parents: 8617
diff changeset
   871
!GenericException class methodsFor:'save evaluation'!
4481
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   872
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   873
catch:aBlock
4496
28f3f57dbe60 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4492
diff changeset
   874
    "evaluate the argument, aBlock.
10239
a4c894b1b8f1 comment
Claus Gittinger <cg@exept.de>
parents: 10189
diff changeset
   875
     If the receiver-exception is raised during evaluation, abort
8617
5fb5a717deff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8509
diff changeset
   876
     the evaluation and return true; otherwise return false.
4496
28f3f57dbe60 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4492
diff changeset
   877
     This is the catch & throw mechanism found in other languages,
28f3f57dbe60 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4492
diff changeset
   878
     where the returned value indicates if an exception occured."
4481
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   879
4496
28f3f57dbe60 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4492
diff changeset
   880
    |raiseOccurred|
4481
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   881
4496
28f3f57dbe60 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4492
diff changeset
   882
    raiseOccurred := false.
28f3f57dbe60 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4492
diff changeset
   883
    self handle:[:ex | raiseOccurred := true. ex return] do:aBlock.
28f3f57dbe60 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4492
diff changeset
   884
    ^ raiseOccurred
4481
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   885
4496
28f3f57dbe60 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4492
diff changeset
   886
    "
28f3f57dbe60 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4492
diff changeset
   887
     Object messageNotUnderstoodSignal catch:[
8617
5fb5a717deff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8509
diff changeset
   888
        123 size open
5fb5a717deff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8509
diff changeset
   889
     ]
4496
28f3f57dbe60 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4492
diff changeset
   890
    "
4481
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   891
10239
a4c894b1b8f1 comment
Claus Gittinger <cg@exept.de>
parents: 10189
diff changeset
   892
    "Created: / 23-07-1999 / 14:06:01 / stefan"
a4c894b1b8f1 comment
Claus Gittinger <cg@exept.de>
parents: 10189
diff changeset
   893
    "Modified: / 07-12-2006 / 17:05:17 / cg"
4481
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   894
!
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   895
6396
74d5b0b588a6 added deferAfter: - defer exceptions until some later time
Claus Gittinger <cg@exept.de>
parents: 6364
diff changeset
   896
deferAfter:aBlock
74d5b0b588a6 added deferAfter: - defer exceptions until some later time
Claus Gittinger <cg@exept.de>
parents: 6364
diff changeset
   897
    "evaluate the argument, aBlock.
10239
a4c894b1b8f1 comment
Claus Gittinger <cg@exept.de>
parents: 10189
diff changeset
   898
     Ignore the receiver-exception during evaluation - i.e. simply continue,
6396
74d5b0b588a6 added deferAfter: - defer exceptions until some later time
Claus Gittinger <cg@exept.de>
parents: 6364
diff changeset
   899
     but remember if the signal was raised.
74d5b0b588a6 added deferAfter: - defer exceptions until some later time
Claus Gittinger <cg@exept.de>
parents: 6364
diff changeset
   900
     After the block evaluation, finally raise the signal - if it was raised in the block.
74d5b0b588a6 added deferAfter: - defer exceptions until some later time
Claus Gittinger <cg@exept.de>
parents: 6364
diff changeset
   901
     If the signal is raised multiple times, only the first raises parameter is remembered,
74d5b0b588a6 added deferAfter: - defer exceptions until some later time
Claus Gittinger <cg@exept.de>
parents: 6364
diff changeset
   902
     and only a single raise is performed after the blocks evaluation.
74d5b0b588a6 added deferAfter: - defer exceptions until some later time
Claus Gittinger <cg@exept.de>
parents: 6364
diff changeset
   903
8617
5fb5a717deff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8509
diff changeset
   904
     Deferring makes sense for some signals, such as UserInterrupt or AbortSignal,
5fb5a717deff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8509
diff changeset
   905
     which must occasionally be delayed temporarily until a save place is reached
6396
74d5b0b588a6 added deferAfter: - defer exceptions until some later time
Claus Gittinger <cg@exept.de>
parents: 6364
diff changeset
   906
     (especially when packages are sent across a communication channel, and you dont want
74d5b0b588a6 added deferAfter: - defer exceptions until some later time
Claus Gittinger <cg@exept.de>
parents: 6364
diff changeset
   907
      partial packages to be generated by user interruptions)."
74d5b0b588a6 added deferAfter: - defer exceptions until some later time
Claus Gittinger <cg@exept.de>
parents: 6364
diff changeset
   908
6430
9a1580465dd2 better impl. of #deferAfter:
Claus Gittinger <cg@exept.de>
parents: 6426
diff changeset
   909
    |coughtException result|
6396
74d5b0b588a6 added deferAfter: - defer exceptions until some later time
Claus Gittinger <cg@exept.de>
parents: 6364
diff changeset
   910
74d5b0b588a6 added deferAfter: - defer exceptions until some later time
Claus Gittinger <cg@exept.de>
parents: 6364
diff changeset
   911
    self handle:[:ex |
8617
5fb5a717deff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8509
diff changeset
   912
        coughtException isNil ifTrue:[
5fb5a717deff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8509
diff changeset
   913
            coughtException := ex.
5fb5a717deff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8509
diff changeset
   914
        ].
5fb5a717deff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8509
diff changeset
   915
        ex proceedWith:nil
6396
74d5b0b588a6 added deferAfter: - defer exceptions until some later time
Claus Gittinger <cg@exept.de>
parents: 6364
diff changeset
   916
    ] do:[
8617
5fb5a717deff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8509
diff changeset
   917
        result := aBlock value.
6396
74d5b0b588a6 added deferAfter: - defer exceptions until some later time
Claus Gittinger <cg@exept.de>
parents: 6364
diff changeset
   918
    ].
6430
9a1580465dd2 better impl. of #deferAfter:
Claus Gittinger <cg@exept.de>
parents: 6426
diff changeset
   919
    coughtException notNil ifTrue:[
8617
5fb5a717deff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8509
diff changeset
   920
        coughtException suspendedContext:thisContext.
5fb5a717deff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8509
diff changeset
   921
5fb5a717deff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8509
diff changeset
   922
        "/ the exception was raised during the execution of aBlock above.
5fb5a717deff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8509
diff changeset
   923
        "/ Raise it now (delayed).
5fb5a717deff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8509
diff changeset
   924
        coughtException raiseSignal.
6396
74d5b0b588a6 added deferAfter: - defer exceptions until some later time
Claus Gittinger <cg@exept.de>
parents: 6364
diff changeset
   925
    ].
74d5b0b588a6 added deferAfter: - defer exceptions until some later time
Claus Gittinger <cg@exept.de>
parents: 6364
diff changeset
   926
    ^ result
74d5b0b588a6 added deferAfter: - defer exceptions until some later time
Claus Gittinger <cg@exept.de>
parents: 6364
diff changeset
   927
6430
9a1580465dd2 better impl. of #deferAfter:
Claus Gittinger <cg@exept.de>
parents: 6426
diff changeset
   928
    "
9a1580465dd2 better impl. of #deferAfter:
Claus Gittinger <cg@exept.de>
parents: 6426
diff changeset
   929
     UserInterrupt deferAfter:[
8617
5fb5a717deff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8509
diff changeset
   930
         Transcript showCR:'1 - now raising, but will be deferred.'.
5fb5a717deff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8509
diff changeset
   931
         UserInterrupt raiseRequestWith:'hello'.
5fb5a717deff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8509
diff changeset
   932
         Transcript showCR:'2 - after the raise, deferred exception will be handled soon.'.
6430
9a1580465dd2 better impl. of #deferAfter:
Claus Gittinger <cg@exept.de>
parents: 6426
diff changeset
   933
     ].
9a1580465dd2 better impl. of #deferAfter:
Claus Gittinger <cg@exept.de>
parents: 6426
diff changeset
   934
     Transcript showCR:'3 - here after the protected block.'.
9a1580465dd2 better impl. of #deferAfter:
Claus Gittinger <cg@exept.de>
parents: 6426
diff changeset
   935
    "
10239
a4c894b1b8f1 comment
Claus Gittinger <cg@exept.de>
parents: 10189
diff changeset
   936
a4c894b1b8f1 comment
Claus Gittinger <cg@exept.de>
parents: 10189
diff changeset
   937
    "Modified: / 07-12-2006 / 17:05:28 / cg"
6396
74d5b0b588a6 added deferAfter: - defer exceptions until some later time
Claus Gittinger <cg@exept.de>
parents: 6364
diff changeset
   938
!
74d5b0b588a6 added deferAfter: - defer exceptions until some later time
Claus Gittinger <cg@exept.de>
parents: 6364
diff changeset
   939
12059
dc79a13a160a added: #evaluate:ifRaised:
Claus Gittinger <cg@exept.de>
parents: 11775
diff changeset
   940
evaluate:aBlock ifRaised:exceptionValue
dc79a13a160a added: #evaluate:ifRaised:
Claus Gittinger <cg@exept.de>
parents: 11775
diff changeset
   941
    "evaluate the argument, aBlock and return its value.
dc79a13a160a added: #evaluate:ifRaised:
Claus Gittinger <cg@exept.de>
parents: 11775
diff changeset
   942
     If the receiver-signal is raised during evaluation, abort
dc79a13a160a added: #evaluate:ifRaised:
Claus Gittinger <cg@exept.de>
parents: 11775
diff changeset
   943
     the evaluation and return the value from exceptionValue. 
dc79a13a160a added: #evaluate:ifRaised:
Claus Gittinger <cg@exept.de>
parents: 11775
diff changeset
   944
     This is similar to the catch & throw mechanism found in other languages"
dc79a13a160a added: #evaluate:ifRaised:
Claus Gittinger <cg@exept.de>
parents: 11775
diff changeset
   945
dc79a13a160a added: #evaluate:ifRaised:
Claus Gittinger <cg@exept.de>
parents: 11775
diff changeset
   946
    ^ self handle:[:ex | exceptionValue value] do:aBlock.
dc79a13a160a added: #evaluate:ifRaised:
Claus Gittinger <cg@exept.de>
parents: 11775
diff changeset
   947
dc79a13a160a added: #evaluate:ifRaised:
Claus Gittinger <cg@exept.de>
parents: 11775
diff changeset
   948
    "
dc79a13a160a added: #evaluate:ifRaised:
Claus Gittinger <cg@exept.de>
parents: 11775
diff changeset
   949
     Object messageNotUnderstoodSignal 
dc79a13a160a added: #evaluate:ifRaised:
Claus Gittinger <cg@exept.de>
parents: 11775
diff changeset
   950
        evaluate:[ 123 size open ]
dc79a13a160a added: #evaluate:ifRaised:
Claus Gittinger <cg@exept.de>
parents: 11775
diff changeset
   951
        ifRaised:345         
dc79a13a160a added: #evaluate:ifRaised:
Claus Gittinger <cg@exept.de>
parents: 11775
diff changeset
   952
    "
dc79a13a160a added: #evaluate:ifRaised:
Claus Gittinger <cg@exept.de>
parents: 11775
diff changeset
   953
!
dc79a13a160a added: #evaluate:ifRaised:
Claus Gittinger <cg@exept.de>
parents: 11775
diff changeset
   954
4481
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   955
handle:handleBlock do:aBlock
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   956
    "evaluate the argument, aBlock.
10239
a4c894b1b8f1 comment
Claus Gittinger <cg@exept.de>
parents: 10189
diff changeset
   957
     If the receiver-exception is raised during evaluation,
4481
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   958
     evaluate the handleBlock passing it an Exception argument.
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   959
     The handler may decide how to react to the signal by sending
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   960
     a corresponding message to the exception (see there).
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   961
     If the signal is not raised, return the value of evaluating
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   962
     aBlock."
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   963
4548
8349abc6b796 Add #handlerProtectedBlock:inContext
Stefan Vogel <sv@exept.de>
parents: 4544
diff changeset
   964
    <context: #return>
4488
db914d752859 must mark returned contexts as returnable
Claus Gittinger <cg@exept.de>
parents: 4484
diff changeset
   965
    <exception: #handle>
db914d752859 must mark returned contexts as returnable
Claus Gittinger <cg@exept.de>
parents: 4484
diff changeset
   966
4491
5041cae5651c use new pragma to flag exception frames.
Claus Gittinger <cg@exept.de>
parents: 4488
diff changeset
   967
    "/ thisContext markForHandle. -- same as above pragma
5041cae5651c use new pragma to flag exception frames.
Claus Gittinger <cg@exept.de>
parents: 4488
diff changeset
   968
    ^ aBlock value  "the real logic is in Exception>>doRaise"
4481
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   969
4491
5041cae5651c use new pragma to flag exception frames.
Claus Gittinger <cg@exept.de>
parents: 4488
diff changeset
   970
    "
5041cae5651c use new pragma to flag exception frames.
Claus Gittinger <cg@exept.de>
parents: 4488
diff changeset
   971
     Object messageNotUnderstoodSignal handle:[:ex |
8617
5fb5a717deff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8509
diff changeset
   972
        'oops' printNL.
5fb5a717deff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8509
diff changeset
   973
        ex return
4491
5041cae5651c use new pragma to flag exception frames.
Claus Gittinger <cg@exept.de>
parents: 4488
diff changeset
   974
     ] do:[
8617
5fb5a717deff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8509
diff changeset
   975
        123 size open
4491
5041cae5651c use new pragma to flag exception frames.
Claus Gittinger <cg@exept.de>
parents: 4488
diff changeset
   976
     ]
5041cae5651c use new pragma to flag exception frames.
Claus Gittinger <cg@exept.de>
parents: 4488
diff changeset
   977
     "
4481
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   978
4491
5041cae5651c use new pragma to flag exception frames.
Claus Gittinger <cg@exept.de>
parents: 4488
diff changeset
   979
     "
5041cae5651c use new pragma to flag exception frames.
Claus Gittinger <cg@exept.de>
parents: 4488
diff changeset
   980
      |num|
4481
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   981
4491
5041cae5651c use new pragma to flag exception frames.
Claus Gittinger <cg@exept.de>
parents: 4488
diff changeset
   982
      num := 0.
5041cae5651c use new pragma to flag exception frames.
Claus Gittinger <cg@exept.de>
parents: 4488
diff changeset
   983
      Number divisionByZeroSignal handle:[:ex |
8617
5fb5a717deff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8509
diff changeset
   984
          'oops' printNL.
5fb5a717deff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8509
diff changeset
   985
          ex return
4491
5041cae5651c use new pragma to flag exception frames.
Claus Gittinger <cg@exept.de>
parents: 4488
diff changeset
   986
      ] do:[
8617
5fb5a717deff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8509
diff changeset
   987
          123 / num
4491
5041cae5651c use new pragma to flag exception frames.
Claus Gittinger <cg@exept.de>
parents: 4488
diff changeset
   988
      ]
5041cae5651c use new pragma to flag exception frames.
Claus Gittinger <cg@exept.de>
parents: 4488
diff changeset
   989
     "
4481
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   990
10239
a4c894b1b8f1 comment
Claus Gittinger <cg@exept.de>
parents: 10189
diff changeset
   991
    "Created: / 23-07-1999 / 14:06:13 / stefan"
a4c894b1b8f1 comment
Claus Gittinger <cg@exept.de>
parents: 10189
diff changeset
   992
    "Modified: / 25-07-1999 / 19:44:05 / stefan"
a4c894b1b8f1 comment
Claus Gittinger <cg@exept.de>
parents: 10189
diff changeset
   993
    "Modified: / 07-12-2006 / 17:05:30 / cg"
4481
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   994
!
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   995
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   996
handle:handleBlock from:anObject do:aBlock
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   997
    "evaluate the argument, aBlock.
10239
a4c894b1b8f1 comment
Claus Gittinger <cg@exept.de>
parents: 10189
diff changeset
   998
     If the receiver-exception is raised during evaluation,
4481
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   999
     and the exception originated from anObject,
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1000
     evaluate the handleBlock passing it an Exception argument.
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1001
     The handler may decide how to react to the signal by sending
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1002
     a corresponding message to the exception (see there).
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1003
     If the signal is not raised, return the value of evaluating
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1004
     aBlock."
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1005
4548
8349abc6b796 Add #handlerProtectedBlock:inContext
Stefan Vogel <sv@exept.de>
parents: 4544
diff changeset
  1006
    <context: #return>
4488
db914d752859 must mark returned contexts as returnable
Claus Gittinger <cg@exept.de>
parents: 4484
diff changeset
  1007
    <exception: #handle>
db914d752859 must mark returned contexts as returnable
Claus Gittinger <cg@exept.de>
parents: 4484
diff changeset
  1008
4491
5041cae5651c use new pragma to flag exception frames.
Claus Gittinger <cg@exept.de>
parents: 4488
diff changeset
  1009
    "/ thisContext markForHandle. -- same as above pragma
5041cae5651c use new pragma to flag exception frames.
Claus Gittinger <cg@exept.de>
parents: 4488
diff changeset
  1010
    ^ aBlock value  "the real logic is in Exception>>doRaise"
4481
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1011
4491
5041cae5651c use new pragma to flag exception frames.
Claus Gittinger <cg@exept.de>
parents: 4488
diff changeset
  1012
    "
5041cae5651c use new pragma to flag exception frames.
Claus Gittinger <cg@exept.de>
parents: 4488
diff changeset
  1013
     the first open will be caught; the second not:
4481
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1014
4491
5041cae5651c use new pragma to flag exception frames.
Claus Gittinger <cg@exept.de>
parents: 4488
diff changeset
  1015
     |o1 o2|
4481
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1016
4491
5041cae5651c use new pragma to flag exception frames.
Claus Gittinger <cg@exept.de>
parents: 4488
diff changeset
  1017
     o1 := 123.
5041cae5651c use new pragma to flag exception frames.
Claus Gittinger <cg@exept.de>
parents: 4488
diff changeset
  1018
     o2 := nil.
8617
5fb5a717deff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8509
diff changeset
  1019
     Object messageNotUnderstoodSignal
5fb5a717deff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8509
diff changeset
  1020
         handle:
5fb5a717deff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8509
diff changeset
  1021
                [:ex |
5fb5a717deff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8509
diff changeset
  1022
                    'oops' printNL.
5fb5a717deff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8509
diff changeset
  1023
                    ex proceed
5fb5a717deff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8509
diff changeset
  1024
                ]
5fb5a717deff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8509
diff changeset
  1025
         from:o1
5fb5a717deff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8509
diff changeset
  1026
         do:
5fb5a717deff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8509
diff changeset
  1027
                [
5fb5a717deff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8509
diff changeset
  1028
                    o1 open.
5fb5a717deff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8509
diff changeset
  1029
                    o2 open
5fb5a717deff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8509
diff changeset
  1030
                ]
4491
5041cae5651c use new pragma to flag exception frames.
Claus Gittinger <cg@exept.de>
parents: 4488
diff changeset
  1031
    "
4481
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1032
10239
a4c894b1b8f1 comment
Claus Gittinger <cg@exept.de>
parents: 10189
diff changeset
  1033
    "Created: / 23-07-1999 / 14:06:26 / stefan"
a4c894b1b8f1 comment
Claus Gittinger <cg@exept.de>
parents: 10189
diff changeset
  1034
    "Modified: / 25-07-1999 / 19:44:13 / stefan"
a4c894b1b8f1 comment
Claus Gittinger <cg@exept.de>
parents: 10189
diff changeset
  1035
    "Modified: / 07-12-2006 / 17:05:33 / cg"
4481
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1036
!
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1037
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1038
ignoreIn:aBlock
4496
28f3f57dbe60 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4492
diff changeset
  1039
    "evaluate the argument, aBlock.
10239
a4c894b1b8f1 comment
Claus Gittinger <cg@exept.de>
parents: 10189
diff changeset
  1040
     Ignore the receiver-exception during evaluation - i.e. simply continue.
4496
28f3f57dbe60 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4492
diff changeset
  1041
     This makes only sense for some signals, such as UserInterrupt
28f3f57dbe60 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4492
diff changeset
  1042
     or AbortSignal, because continuing after an exception without any cleanup
28f3f57dbe60 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4492
diff changeset
  1043
     often leads to followup-errors."
4481
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1044
4496
28f3f57dbe60 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4492
diff changeset
  1045
    ^ self handle:[:ex | ex proceedWith:nil] do:aBlock.
4481
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1046
4496
28f3f57dbe60 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4492
diff changeset
  1047
    "
28f3f57dbe60 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4492
diff changeset
  1048
     Object messageNotUnderstoodSignal ignoreIn:[
8617
5fb5a717deff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8509
diff changeset
  1049
        123 size open
4496
28f3f57dbe60 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4492
diff changeset
  1050
     ]
28f3f57dbe60 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4492
diff changeset
  1051
    "
4481
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1052
10239
a4c894b1b8f1 comment
Claus Gittinger <cg@exept.de>
parents: 10189
diff changeset
  1053
    "Created: / 23-07-1999 / 14:06:40 / stefan"
a4c894b1b8f1 comment
Claus Gittinger <cg@exept.de>
parents: 10189
diff changeset
  1054
    "Modified: / 07-12-2006 / 17:05:35 / cg"
4481
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1055
! !
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1056
8677
d09ee4c45c17 categories and comments
Stefan Vogel <sv@exept.de>
parents: 8617
diff changeset
  1057
!GenericException class methodsFor:'testing'!
6200
65f0631e5221 added #isControlInterrupt
Claus Gittinger <cg@exept.de>
parents: 6198
diff changeset
  1058
65f0631e5221 added #isControlInterrupt
Claus Gittinger <cg@exept.de>
parents: 6198
diff changeset
  1059
isControlInterrupt
65f0631e5221 added #isControlInterrupt
Claus Gittinger <cg@exept.de>
parents: 6198
diff changeset
  1060
    ^ false
65f0631e5221 added #isControlInterrupt
Claus Gittinger <cg@exept.de>
parents: 6198
diff changeset
  1061
65f0631e5221 added #isControlInterrupt
Claus Gittinger <cg@exept.de>
parents: 6198
diff changeset
  1062
    "Created: / 16.11.2001 / 16:11:54 / cg"
4936
bc943fef0d96 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4758
diff changeset
  1063
!
bc943fef0d96 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4758
diff changeset
  1064
8677
d09ee4c45c17 categories and comments
Stefan Vogel <sv@exept.de>
parents: 8617
diff changeset
  1065
isExceptionCreator
d09ee4c45c17 categories and comments
Stefan Vogel <sv@exept.de>
parents: 8617
diff changeset
  1066
    "return true, if the receiver can create exceptions,
d09ee4c45c17 categories and comments
Stefan Vogel <sv@exept.de>
parents: 8617
diff changeset
  1067
     this includes #raise, #raiseRequest as well as the behavior of
d09ee4c45c17 categories and comments
Stefan Vogel <sv@exept.de>
parents: 8617
diff changeset
  1068
     an exception handler, such as the #accepts: and #handles: messages"
8254
73b6109ab982 Use Timestamp/#asTimestamp instead of AbsoluteTime/#asAbsoluteTime
Stefan Vogel <sv@exept.de>
parents: 8238
diff changeset
  1069
8677
d09ee4c45c17 categories and comments
Stefan Vogel <sv@exept.de>
parents: 8617
diff changeset
  1070
    ^ true
4936
bc943fef0d96 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4758
diff changeset
  1071
!
bc943fef0d96 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4758
diff changeset
  1072
8677
d09ee4c45c17 categories and comments
Stefan Vogel <sv@exept.de>
parents: 8617
diff changeset
  1073
isExceptionHandler
d09ee4c45c17 categories and comments
Stefan Vogel <sv@exept.de>
parents: 8617
diff changeset
  1074
    "return true, if the receiver responds to the exception handler protocol,
d09ee4c45c17 categories and comments
Stefan Vogel <sv@exept.de>
parents: 8617
diff changeset
  1075
     especially to the #accepts: and #handles: messages"
8254
73b6109ab982 Use Timestamp/#asTimestamp instead of AbsoluteTime/#asAbsoluteTime
Stefan Vogel <sv@exept.de>
parents: 8238
diff changeset
  1076
8677
d09ee4c45c17 categories and comments
Stefan Vogel <sv@exept.de>
parents: 8617
diff changeset
  1077
    ^ true
8254
73b6109ab982 Use Timestamp/#asTimestamp instead of AbsoluteTime/#asAbsoluteTime
Stefan Vogel <sv@exept.de>
parents: 8238
diff changeset
  1078
8677
d09ee4c45c17 categories and comments
Stefan Vogel <sv@exept.de>
parents: 8617
diff changeset
  1079
    "Created: / 23.7.1999 / 13:49:59 / stefan"
4936
bc943fef0d96 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4758
diff changeset
  1080
!
bc943fef0d96 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4758
diff changeset
  1081
8677
d09ee4c45c17 categories and comments
Stefan Vogel <sv@exept.de>
parents: 8617
diff changeset
  1082
isQuerySignal
d09ee4c45c17 categories and comments
Stefan Vogel <sv@exept.de>
parents: 8617
diff changeset
  1083
    "return true, if this is a querySignal - always return false here"
4936
bc943fef0d96 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4758
diff changeset
  1084
8677
d09ee4c45c17 categories and comments
Stefan Vogel <sv@exept.de>
parents: 8617
diff changeset
  1085
    ^ false
4936
bc943fef0d96 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4758
diff changeset
  1086
8677
d09ee4c45c17 categories and comments
Stefan Vogel <sv@exept.de>
parents: 8617
diff changeset
  1087
    "Created: / 23.7.1999 / 13:50:16 / stefan"
5058
42e732f3497c added another useful handler
Claus Gittinger <cg@exept.de>
parents: 4936
diff changeset
  1088
!
42e732f3497c added another useful handler
Claus Gittinger <cg@exept.de>
parents: 4936
diff changeset
  1089
8677
d09ee4c45c17 categories and comments
Stefan Vogel <sv@exept.de>
parents: 8617
diff changeset
  1090
mayProceed
d09ee4c45c17 categories and comments
Stefan Vogel <sv@exept.de>
parents: 8617
diff changeset
  1091
    "return true, if the exception handler is allowed to proceed
d09ee4c45c17 categories and comments
Stefan Vogel <sv@exept.de>
parents: 8617
diff changeset
  1092
     the execution where the exception occured.
8390
d78cd984f201 return values for #proceedWith:
Stefan Vogel <sv@exept.de>
parents: 8313
diff changeset
  1093
8677
d09ee4c45c17 categories and comments
Stefan Vogel <sv@exept.de>
parents: 8617
diff changeset
  1094
     Subclasses may redefine this."
5058
42e732f3497c added another useful handler
Claus Gittinger <cg@exept.de>
parents: 4936
diff changeset
  1095
8677
d09ee4c45c17 categories and comments
Stefan Vogel <sv@exept.de>
parents: 8617
diff changeset
  1096
    ^ true
5058
42e732f3497c added another useful handler
Claus Gittinger <cg@exept.de>
parents: 4936
diff changeset
  1097
8677
d09ee4c45c17 categories and comments
Stefan Vogel <sv@exept.de>
parents: 8617
diff changeset
  1098
    "Modified: / 23.7.1999 / 14:50:11 / stefan"
4936
bc943fef0d96 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4758
diff changeset
  1099
! !
bc943fef0d96 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4758
diff changeset
  1100
14962
2d0932f775a2 class: GenericException
Claus Gittinger <cg@exept.de>
parents: 14241
diff changeset
  1101
7261
f35fc9cee675 method category rename
Claus Gittinger <cg@exept.de>
parents: 6945
diff changeset
  1102
!GenericException methodsFor:'Compatibility-ANSI'!
5680
7c27d1de0c56 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5590
diff changeset
  1103
5933
af2939dac9bf added #pass for compatibility
Claus Gittinger <cg@exept.de>
parents: 5927
diff changeset
  1104
pass
16157
f4cb5106557f class: GenericException
Claus Gittinger <cg@exept.de>
parents: 16148
diff changeset
  1105
    "same as reject - for ANSI compatibility"
f4cb5106557f class: GenericException
Claus Gittinger <cg@exept.de>
parents: 16148
diff changeset
  1106
5933
af2939dac9bf added #pass for compatibility
Claus Gittinger <cg@exept.de>
parents: 5927
diff changeset
  1107
    ^ self reject
af2939dac9bf added #pass for compatibility
Claus Gittinger <cg@exept.de>
parents: 5927
diff changeset
  1108
!
af2939dac9bf added #pass for compatibility
Claus Gittinger <cg@exept.de>
parents: 5927
diff changeset
  1109
5985
4bffb803f9e8 more ANSI stuff
Claus Gittinger <cg@exept.de>
parents: 5984
diff changeset
  1110
retry
4bffb803f9e8 more ANSI stuff
Claus Gittinger <cg@exept.de>
parents: 5984
diff changeset
  1111
    "same as #restart - ANSI & VW compatibility"
4bffb803f9e8 more ANSI stuff
Claus Gittinger <cg@exept.de>
parents: 5984
diff changeset
  1112
4bffb803f9e8 more ANSI stuff
Claus Gittinger <cg@exept.de>
parents: 5984
diff changeset
  1113
    self restart
4bffb803f9e8 more ANSI stuff
Claus Gittinger <cg@exept.de>
parents: 5984
diff changeset
  1114
4bffb803f9e8 more ANSI stuff
Claus Gittinger <cg@exept.de>
parents: 5984
diff changeset
  1115
    "Created: / 7.9.2001 / 13:31:02 / cg"
4bffb803f9e8 more ANSI stuff
Claus Gittinger <cg@exept.de>
parents: 5984
diff changeset
  1116
!
4bffb803f9e8 more ANSI stuff
Claus Gittinger <cg@exept.de>
parents: 5984
diff changeset
  1117
7674
73acec69e93c compatibility: +retryUsing:
Claus Gittinger <cg@exept.de>
parents: 7631
diff changeset
  1118
retryUsing: alternativeBlock
73acec69e93c compatibility: +retryUsing:
Claus Gittinger <cg@exept.de>
parents: 7631
diff changeset
  1119
    "Abort an exception handler and evaluate a new block in place of the handler's protected block."
73acec69e93c compatibility: +retryUsing:
Claus Gittinger <cg@exept.de>
parents: 7631
diff changeset
  1120
73acec69e93c compatibility: +retryUsing:
Claus Gittinger <cg@exept.de>
parents: 7631
diff changeset
  1121
    "/ self mustBeHandled ifFalse: [ ^self ].
73acec69e93c compatibility: +retryUsing:
Claus Gittinger <cg@exept.de>
parents: 7631
diff changeset
  1122
73acec69e93c compatibility: +retryUsing:
Claus Gittinger <cg@exept.de>
parents: 7631
diff changeset
  1123
    ^ self restartDo:alternativeBlock
73acec69e93c compatibility: +retryUsing:
Claus Gittinger <cg@exept.de>
parents: 7631
diff changeset
  1124
!
73acec69e93c compatibility: +retryUsing:
Claus Gittinger <cg@exept.de>
parents: 7631
diff changeset
  1125
15123
aa1c95f7808c class: GenericException
Claus Gittinger <cg@exept.de>
parents: 15101
diff changeset
  1126
signalWith:messageTextArg
aa1c95f7808c class: GenericException
Claus Gittinger <cg@exept.de>
parents: 15101
diff changeset
  1127
    "raise a signal proceedable or nonproceedable (whichever is right).
aa1c95f7808c class: GenericException
Claus Gittinger <cg@exept.de>
parents: 15101
diff changeset
  1128
     The argument is used as messageText.
aa1c95f7808c class: GenericException
Claus Gittinger <cg@exept.de>
parents: 15101
diff changeset
  1129
     ANSI compatibility."
aa1c95f7808c class: GenericException
Claus Gittinger <cg@exept.de>
parents: 15101
diff changeset
  1130
aa1c95f7808c class: GenericException
Claus Gittinger <cg@exept.de>
parents: 15101
diff changeset
  1131
    self messageText:messageTextArg.
8677
d09ee4c45c17 categories and comments
Stefan Vogel <sv@exept.de>
parents: 8617
diff changeset
  1132
    ^ self raise
5697
ce78c7d9ddbd raiseSignal / raiseSignal: / raiseSignal:with:
Claus Gittinger <cg@exept.de>
parents: 5684
diff changeset
  1133
! !
5680
7c27d1de0c56 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5590
diff changeset
  1134
12559
3b0de1014cd7 added: #stackTrace:
Claus Gittinger <cg@exept.de>
parents: 12156
diff changeset
  1135
!GenericException methodsFor:'Compatibility-Dolphin'!
3b0de1014cd7 added: #stackTrace:
Claus Gittinger <cg@exept.de>
parents: 12156
diff changeset
  1136
3b0de1014cd7 added: #stackTrace:
Claus Gittinger <cg@exept.de>
parents: 12156
diff changeset
  1137
stackTrace:numberOfFrames
12561
3ddfe512ada9 changed: #stackTrace:
Claus Gittinger <cg@exept.de>
parents: 12560
diff changeset
  1138
    "return a backtrace information string"
12559
3b0de1014cd7 added: #stackTrace:
Claus Gittinger <cg@exept.de>
parents: 12156
diff changeset
  1139
3b0de1014cd7 added: #stackTrace:
Claus Gittinger <cg@exept.de>
parents: 12156
diff changeset
  1140
    |con|
3b0de1014cd7 added: #stackTrace:
Claus Gittinger <cg@exept.de>
parents: 12156
diff changeset
  1141
3b0de1014cd7 added: #stackTrace:
Claus Gittinger <cg@exept.de>
parents: 12156
diff changeset
  1142
    con := suspendedContext.
12560
779e4c0930fb changed: #stackTrace:
Claus Gittinger <cg@exept.de>
parents: 12559
diff changeset
  1143
    ^ ((1 to:numberOfFrames)
12559
3b0de1014cd7 added: #stackTrace:
Claus Gittinger <cg@exept.de>
parents: 12156
diff changeset
  1144
        collect:[:idx |
12560
779e4c0930fb changed: #stackTrace:
Claus Gittinger <cg@exept.de>
parents: 12559
diff changeset
  1145
            |s|
779e4c0930fb changed: #stackTrace:
Claus Gittinger <cg@exept.de>
parents: 12559
diff changeset
  1146
779e4c0930fb changed: #stackTrace:
Claus Gittinger <cg@exept.de>
parents: 12559
diff changeset
  1147
            s := con printString.
12559
3b0de1014cd7 added: #stackTrace:
Claus Gittinger <cg@exept.de>
parents: 12156
diff changeset
  1148
            con := con sender.
12560
779e4c0930fb changed: #stackTrace:
Claus Gittinger <cg@exept.de>
parents: 12559
diff changeset
  1149
            s
779e4c0930fb changed: #stackTrace:
Claus Gittinger <cg@exept.de>
parents: 12559
diff changeset
  1150
        ]) asStringWith:Character cr.
12559
3b0de1014cd7 added: #stackTrace:
Claus Gittinger <cg@exept.de>
parents: 12156
diff changeset
  1151
3b0de1014cd7 added: #stackTrace:
Claus Gittinger <cg@exept.de>
parents: 12156
diff changeset
  1152
    "
3b0de1014cd7 added: #stackTrace:
Claus Gittinger <cg@exept.de>
parents: 12156
diff changeset
  1153
     Error handle:[:ex |
3b0de1014cd7 added: #stackTrace:
Claus Gittinger <cg@exept.de>
parents: 12156
diff changeset
  1154
        (ex stackTrace:20) inspect.
3b0de1014cd7 added: #stackTrace:
Claus Gittinger <cg@exept.de>
parents: 12156
diff changeset
  1155
     ] do:[
3b0de1014cd7 added: #stackTrace:
Claus Gittinger <cg@exept.de>
parents: 12156
diff changeset
  1156
        self error
3b0de1014cd7 added: #stackTrace:
Claus Gittinger <cg@exept.de>
parents: 12156
diff changeset
  1157
     ].
3b0de1014cd7 added: #stackTrace:
Claus Gittinger <cg@exept.de>
parents: 12156
diff changeset
  1158
    "
3b0de1014cd7 added: #stackTrace:
Claus Gittinger <cg@exept.de>
parents: 12156
diff changeset
  1159
! !
3b0de1014cd7 added: #stackTrace:
Claus Gittinger <cg@exept.de>
parents: 12156
diff changeset
  1160
12572
5357a310199b added: #signalerContext
Claus Gittinger <cg@exept.de>
parents: 12561
diff changeset
  1161
!GenericException methodsFor:'Compatibility-Squeak'!
5357a310199b added: #signalerContext
Claus Gittinger <cg@exept.de>
parents: 12561
diff changeset
  1162
5357a310199b added: #signalerContext
Claus Gittinger <cg@exept.de>
parents: 12561
diff changeset
  1163
signalerContext
5357a310199b added: #signalerContext
Claus Gittinger <cg@exept.de>
parents: 12561
diff changeset
  1164
    ^ self suspendedContext
5357a310199b added: #signalerContext
Claus Gittinger <cg@exept.de>
parents: 12561
diff changeset
  1165
! !
5357a310199b added: #signalerContext
Claus Gittinger <cg@exept.de>
parents: 12561
diff changeset
  1166
13055
e1b9a8ca766e added: #exitWith:
Claus Gittinger <cg@exept.de>
parents: 13009
diff changeset
  1167
!GenericException methodsFor:'Compatibility-V''Age'!
e1b9a8ca766e added: #exitWith:
Claus Gittinger <cg@exept.de>
parents: 13009
diff changeset
  1168
e1b9a8ca766e added: #exitWith:
Claus Gittinger <cg@exept.de>
parents: 13009
diff changeset
  1169
exitWith:value
16224
2194bc886b30 class: GenericException
Claus Gittinger <cg@exept.de>
parents: 16190
diff changeset
  1170
    "return with a value.
2194bc886b30 class: GenericException
Claus Gittinger <cg@exept.de>
parents: 16190
diff changeset
  1171
     V'AGE compatibility."
2194bc886b30 class: GenericException
Claus Gittinger <cg@exept.de>
parents: 16190
diff changeset
  1172
13055
e1b9a8ca766e added: #exitWith:
Claus Gittinger <cg@exept.de>
parents: 13009
diff changeset
  1173
    ^ self return:value
e1b9a8ca766e added: #exitWith:
Claus Gittinger <cg@exept.de>
parents: 13009
diff changeset
  1174
e1b9a8ca766e added: #exitWith:
Claus Gittinger <cg@exept.de>
parents: 13009
diff changeset
  1175
    "Created: / 28-08-2010 / 14:43:23 / cg"
e1b9a8ca766e added: #exitWith:
Claus Gittinger <cg@exept.de>
parents: 13009
diff changeset
  1176
! !
e1b9a8ca766e added: #exitWith:
Claus Gittinger <cg@exept.de>
parents: 13009
diff changeset
  1177
4481
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1178
!GenericException methodsFor:'accessing'!
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1179
10777
fcdf87d883f7 +catchInDebugger
ca
parents: 10753
diff changeset
  1180
catchInDebugger
fcdf87d883f7 +catchInDebugger
ca
parents: 10753
diff changeset
  1181
    "if set, the debugger will handle this signal in its event loop and will close itself
fcdf87d883f7 +catchInDebugger
ca
parents: 10753
diff changeset
  1182
     without asking for close-confirmation.
fcdf87d883f7 +catchInDebugger
ca
parents: 10753
diff changeset
  1183
     This allows for debugged processes to be terminated without a user confirmation dialog
fcdf87d883f7 +catchInDebugger
ca
parents: 10753
diff changeset
  1184
     (for now, this is used in expecco's hard-terminate function to shut down any open debuggers
11710
8e6d1d366d30 added dummy catchInDebugger
Claus Gittinger <cg@exept.de>
parents: 11640
diff changeset
  1185
      together with the test-process).
8e6d1d366d30 added dummy catchInDebugger
Claus Gittinger <cg@exept.de>
parents: 11640
diff changeset
  1186
     Dummy here"
10777
fcdf87d883f7 +catchInDebugger
ca
parents: 10753
diff changeset
  1187
fcdf87d883f7 +catchInDebugger
ca
parents: 10753
diff changeset
  1188
    ^ false
fcdf87d883f7 +catchInDebugger
ca
parents: 10753
diff changeset
  1189
!
fcdf87d883f7 +catchInDebugger
ca
parents: 10753
diff changeset
  1190
11710
8e6d1d366d30 added dummy catchInDebugger
Claus Gittinger <cg@exept.de>
parents: 11640
diff changeset
  1191
catchInDebugger:aBoolean
8e6d1d366d30 added dummy catchInDebugger
Claus Gittinger <cg@exept.de>
parents: 11640
diff changeset
  1192
    "if set, the debugger will handle this signal in its event loop and will close itself
8e6d1d366d30 added dummy catchInDebugger
Claus Gittinger <cg@exept.de>
parents: 11640
diff changeset
  1193
     without asking for close-confirmation.
8e6d1d366d30 added dummy catchInDebugger
Claus Gittinger <cg@exept.de>
parents: 11640
diff changeset
  1194
     This allows for debugged processes to be terminated without a user confirmation dialog
8e6d1d366d30 added dummy catchInDebugger
Claus Gittinger <cg@exept.de>
parents: 11640
diff changeset
  1195
     (for now, this is used in expecco's hard-terminate function to shut down any open debuggers
8e6d1d366d30 added dummy catchInDebugger
Claus Gittinger <cg@exept.de>
parents: 11640
diff changeset
  1196
      together with the test-process).
8e6d1d366d30 added dummy catchInDebugger
Claus Gittinger <cg@exept.de>
parents: 11640
diff changeset
  1197
     Dummy here"
8e6d1d366d30 added dummy catchInDebugger
Claus Gittinger <cg@exept.de>
parents: 11640
diff changeset
  1198
8e6d1d366d30 added dummy catchInDebugger
Claus Gittinger <cg@exept.de>
parents: 11640
diff changeset
  1199
    "/ ignored
8e6d1d366d30 added dummy catchInDebugger
Claus Gittinger <cg@exept.de>
parents: 11640
diff changeset
  1200
!
8e6d1d366d30 added dummy catchInDebugger
Claus Gittinger <cg@exept.de>
parents: 11640
diff changeset
  1201
4562
2cd0c20d8970 Add #description, #creator
Stefan Vogel <sv@exept.de>
parents: 4556
diff changeset
  1202
creator
15336
e9db6bdf3f10 class: GenericException
Stefan Vogel <sv@exept.de>
parents: 15321
diff changeset
  1203
    "return the creator of the exception"
e9db6bdf3f10 class: GenericException
Stefan Vogel <sv@exept.de>
parents: 15321
diff changeset
  1204
e9db6bdf3f10 class: GenericException
Stefan Vogel <sv@exept.de>
parents: 15321
diff changeset
  1205
    signal notNil ifTrue:[^ signal] ifFalse:[^ self class]
4562
2cd0c20d8970 Add #description, #creator
Stefan Vogel <sv@exept.de>
parents: 4556
diff changeset
  1206
!
2cd0c20d8970 Add #description, #creator
Stefan Vogel <sv@exept.de>
parents: 4556
diff changeset
  1207
8617
5fb5a717deff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8509
diff changeset
  1208
errorString
4481
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1209
    "return the errorString passsed with the signal raise
4562
2cd0c20d8970 Add #description, #creator
Stefan Vogel <sv@exept.de>
parents: 4556
diff changeset
  1210
     (or nil, if there was none).
2cd0c20d8970 Add #description, #creator
Stefan Vogel <sv@exept.de>
parents: 4556
diff changeset
  1211
     #errorString is deprecated, use description instead"
4481
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1212
6859
5ef85865e8db Print exception description with #printOn:
Stefan Vogel <sv@exept.de>
parents: 6630
diff changeset
  1213
    <resource:#obsolete>
4562
2cd0c20d8970 Add #description, #creator
Stefan Vogel <sv@exept.de>
parents: 4556
diff changeset
  1214
2cd0c20d8970 Add #description, #creator
Stefan Vogel <sv@exept.de>
parents: 4556
diff changeset
  1215
    ^ self description
4481
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1216
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1217
    "Modified: / 12.3.1998 / 15:13:28 / stefan"
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1218
!
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1219
8617
5fb5a717deff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8509
diff changeset
  1220
errorString:aString
8313
2aa626e8e404 Fix do not execute an exception handler inside the do-block, when the
Stefan Vogel <sv@exept.de>
parents: 8254
diff changeset
  1221
    "set the messageText.
2aa626e8e404 Fix do not execute an exception handler inside the do-block, when the
Stefan Vogel <sv@exept.de>
parents: 8254
diff changeset
  1222
     If it starts with a space, the signals messageText is prepended,
4562
2cd0c20d8970 Add #description, #creator
Stefan Vogel <sv@exept.de>
parents: 4556
diff changeset
  1223
     if it ends with a space, it is appended.
2cd0c20d8970 Add #description, #creator
Stefan Vogel <sv@exept.de>
parents: 4556
diff changeset
  1224
     #errorString: is deprecated, use messageText: instead"
4481
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1225
6859
5ef85865e8db Print exception description with #printOn:
Stefan Vogel <sv@exept.de>
parents: 6630
diff changeset
  1226
    <resource:#obsolete>
5ef85865e8db Print exception description with #printOn:
Stefan Vogel <sv@exept.de>
parents: 6630
diff changeset
  1227
8313
2aa626e8e404 Fix do not execute an exception handler inside the do-block, when the
Stefan Vogel <sv@exept.de>
parents: 8254
diff changeset
  1228
    messageText := aString
4481
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1229
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1230
    "Created: / 5.3.1998 / 16:45:29 / stefan"
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1231
    "Modified: / 12.3.1998 / 15:30:45 / stefan"
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1232
!
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1233
8681
38aa963476a5 Support for Block>>#on:do:on:do:
Stefan Vogel <sv@exept.de>
parents: 8677
diff changeset
  1234
handler
38aa963476a5 Support for Block>>#on:do:on:do:
Stefan Vogel <sv@exept.de>
parents: 8677
diff changeset
  1235
    "return the exception handler (Signal or SignalSet or ExceptionHandlerSet or Exception)
38aa963476a5 Support for Block>>#on:do:on:do:
Stefan Vogel <sv@exept.de>
parents: 8677
diff changeset
  1236
     that handles the exception.
38aa963476a5 Support for Block>>#on:do:on:do:
Stefan Vogel <sv@exept.de>
parents: 8677
diff changeset
  1237
     This is only valid during handler evaluation, and answers
38aa963476a5 Support for Block>>#on:do:on:do:
Stefan Vogel <sv@exept.de>
parents: 8677
diff changeset
  1238
     the object which accepted the actual exception."
38aa963476a5 Support for Block>>#on:do:on:do:
Stefan Vogel <sv@exept.de>
parents: 8677
diff changeset
  1239
38aa963476a5 Support for Block>>#on:do:on:do:
Stefan Vogel <sv@exept.de>
parents: 8677
diff changeset
  1240
    handlerContext isNil ifTrue:[
38aa963476a5 Support for Block>>#on:do:on:do:
Stefan Vogel <sv@exept.de>
parents: 8677
diff changeset
  1241
        ^ nil.
38aa963476a5 Support for Block>>#on:do:on:do:
Stefan Vogel <sv@exept.de>
parents: 8677
diff changeset
  1242
    ].
38aa963476a5 Support for Block>>#on:do:on:do:
Stefan Vogel <sv@exept.de>
parents: 8677
diff changeset
  1243
    ^ handlerContext receiver exceptionHandlerFor:self in:handlerContext.
38aa963476a5 Support for Block>>#on:do:on:do:
Stefan Vogel <sv@exept.de>
parents: 8677
diff changeset
  1244
38aa963476a5 Support for Block>>#on:do:on:do:
Stefan Vogel <sv@exept.de>
parents: 8677
diff changeset
  1245
    "
38aa963476a5 Support for Block>>#on:do:on:do:
Stefan Vogel <sv@exept.de>
parents: 8677
diff changeset
  1246
      [
38aa963476a5 Support for Block>>#on:do:on:do:
Stefan Vogel <sv@exept.de>
parents: 8677
diff changeset
  1247
          2 // 0
38aa963476a5 Support for Block>>#on:do:on:do:
Stefan Vogel <sv@exept.de>
parents: 8677
diff changeset
  1248
      ] on:Error do:[:ex| ex handler inspect]
38aa963476a5 Support for Block>>#on:do:on:do:
Stefan Vogel <sv@exept.de>
parents: 8677
diff changeset
  1249
38aa963476a5 Support for Block>>#on:do:on:do:
Stefan Vogel <sv@exept.de>
parents: 8677
diff changeset
  1250
      [
38aa963476a5 Support for Block>>#on:do:on:do:
Stefan Vogel <sv@exept.de>
parents: 8677
diff changeset
  1251
          2 // 0
38aa963476a5 Support for Block>>#on:do:on:do:
Stefan Vogel <sv@exept.de>
parents: 8677
diff changeset
  1252
      ] on:ArithmeticError, Error do:[:ex| ex handler inspect]
38aa963476a5 Support for Block>>#on:do:on:do:
Stefan Vogel <sv@exept.de>
parents: 8677
diff changeset
  1253
38aa963476a5 Support for Block>>#on:do:on:do:
Stefan Vogel <sv@exept.de>
parents: 8677
diff changeset
  1254
      [
38aa963476a5 Support for Block>>#on:do:on:do:
Stefan Vogel <sv@exept.de>
parents: 8677
diff changeset
  1255
          2 // 0
38aa963476a5 Support for Block>>#on:do:on:do:
Stefan Vogel <sv@exept.de>
parents: 8677
diff changeset
  1256
      ] on:MessageNotUnderstood do:[:ex| ex handler inspect]
38aa963476a5 Support for Block>>#on:do:on:do:
Stefan Vogel <sv@exept.de>
parents: 8677
diff changeset
  1257
        on:Error do:[:ex| ex handler inspect]
38aa963476a5 Support for Block>>#on:do:on:do:
Stefan Vogel <sv@exept.de>
parents: 8677
diff changeset
  1258
    "
38aa963476a5 Support for Block>>#on:do:on:do:
Stefan Vogel <sv@exept.de>
parents: 8677
diff changeset
  1259
!
38aa963476a5 Support for Block>>#on:do:on:do:
Stefan Vogel <sv@exept.de>
parents: 8677
diff changeset
  1260
4481
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1261
handlerContext
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1262
    "return the context of the handler"
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1263
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1264
    ^ handlerContext
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1265
!
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1266
4483
55530226d243 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4481
diff changeset
  1267
handlingException
8681
38aa963476a5 Support for Block>>#on:do:on:do:
Stefan Vogel <sv@exept.de>
parents: 8677
diff changeset
  1268
    <resource: #obsolete>
38aa963476a5 Support for Block>>#on:do:on:do:
Stefan Vogel <sv@exept.de>
parents: 8677
diff changeset
  1269
    ^ self handler
4481
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1270
!
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1271
4484
9476c82921d0 eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents: 4483
diff changeset
  1272
isResumable
9476c82921d0 eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents: 4483
diff changeset
  1273
    "return true, if the exception is resumable"
9476c82921d0 eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents: 4483
diff changeset
  1274
16248
933761e57891 class: GenericException
Stefan Vogel <sv@exept.de>
parents: 16224
diff changeset
  1275
    ^ self mayProceed
4484
9476c82921d0 eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents: 4483
diff changeset
  1276
9476c82921d0 eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents: 4483
diff changeset
  1277
    "Modified: / 2.3.1998 / 12:20:43 / stefan"
9476c82921d0 eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents: 4483
diff changeset
  1278
!
9476c82921d0 eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents: 4483
diff changeset
  1279
7597
db72d9d640bc +isResumable: (VW compat.)
Claus Gittinger <cg@exept.de>
parents: 7560
diff changeset
  1280
isResumable:aBoolean
db72d9d640bc +isResumable: (VW compat.)
Claus Gittinger <cg@exept.de>
parents: 7560
diff changeset
  1281
    proceedable := aBoolean
db72d9d640bc +isResumable: (VW compat.)
Claus Gittinger <cg@exept.de>
parents: 7560
diff changeset
  1282
!
db72d9d640bc +isResumable: (VW compat.)
Claus Gittinger <cg@exept.de>
parents: 7560
diff changeset
  1283
5950
5757b9ba4ff2 added #messageText
Claus Gittinger <cg@exept.de>
parents: 5939
diff changeset
  1284
messageText
7808
824d0e2a3f5c fix spelling error
Stefan Vogel <sv@exept.de>
parents: 7753
diff changeset
  1285
    "return the explicit given messageText - nil, if signaler did not provide one."
5950
5757b9ba4ff2 added #messageText
Claus Gittinger <cg@exept.de>
parents: 5939
diff changeset
  1286
8313
2aa626e8e404 Fix do not execute an exception handler inside the do-block, when the
Stefan Vogel <sv@exept.de>
parents: 8254
diff changeset
  1287
    ^ messageText
5950
5757b9ba4ff2 added #messageText
Claus Gittinger <cg@exept.de>
parents: 5939
diff changeset
  1288
!
5757b9ba4ff2 added #messageText
Claus Gittinger <cg@exept.de>
parents: 5939
diff changeset
  1289
8617
5fb5a717deff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8509
diff changeset
  1290
messageText:aString
4562
2cd0c20d8970 Add #description, #creator
Stefan Vogel <sv@exept.de>
parents: 4556
diff changeset
  1291
    "set the messageText.
15584
64f0803fe869 class: GenericException
Claus Gittinger <cg@exept.de>
parents: 15403
diff changeset
  1292
     If it starts with a space, the signal's original messageText is prepended,
4562
2cd0c20d8970 Add #description, #creator
Stefan Vogel <sv@exept.de>
parents: 4556
diff changeset
  1293
     if it ends with a space, it is appended."
2cd0c20d8970 Add #description, #creator
Stefan Vogel <sv@exept.de>
parents: 4556
diff changeset
  1294
8313
2aa626e8e404 Fix do not execute an exception handler inside the do-block, when the
Stefan Vogel <sv@exept.de>
parents: 8254
diff changeset
  1295
    messageText := aString
4562
2cd0c20d8970 Add #description, #creator
Stefan Vogel <sv@exept.de>
parents: 4556
diff changeset
  1296
15584
64f0803fe869 class: GenericException
Claus Gittinger <cg@exept.de>
parents: 15403
diff changeset
  1297
    "Created: / 05-03-1998 / 16:45:29 / stefan"
64f0803fe869 class: GenericException
Claus Gittinger <cg@exept.de>
parents: 15403
diff changeset
  1298
    "Modified: / 12-03-1998 / 15:30:45 / stefan"
64f0803fe869 class: GenericException
Claus Gittinger <cg@exept.de>
parents: 15403
diff changeset
  1299
    "Modified (comment): / 30-07-2013 / 21:04:43 / cg"
4562
2cd0c20d8970 Add #description, #creator
Stefan Vogel <sv@exept.de>
parents: 4556
diff changeset
  1300
!
2cd0c20d8970 Add #description, #creator
Stefan Vogel <sv@exept.de>
parents: 4556
diff changeset
  1301
14962
2d0932f775a2 class: GenericException
Claus Gittinger <cg@exept.de>
parents: 14241
diff changeset
  1302
originalSignal
2d0932f775a2 class: GenericException
Claus Gittinger <cg@exept.de>
parents: 14241
diff changeset
  1303
    "return the signal/exception which was originally raised.
2d0932f775a2 class: GenericException
Claus Gittinger <cg@exept.de>
parents: 14241
diff changeset
  1304
     For noHandler, that is my unhandled signal; for others, thats the exception itself."
2d0932f775a2 class: GenericException
Claus Gittinger <cg@exept.de>
parents: 14241
diff changeset
  1305
2d0932f775a2 class: GenericException
Claus Gittinger <cg@exept.de>
parents: 14241
diff changeset
  1306
    ^ self.
2d0932f775a2 class: GenericException
Claus Gittinger <cg@exept.de>
parents: 14241
diff changeset
  1307
!
2d0932f775a2 class: GenericException
Claus Gittinger <cg@exept.de>
parents: 14241
diff changeset
  1308
8617
5fb5a717deff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8509
diff changeset
  1309
originator
4481
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1310
    "return the originator passsed with the signal raise
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1311
     (or nil, if there was none)"
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1312
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1313
    ^ originator
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1314
!
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1315
8617
5fb5a717deff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8509
diff changeset
  1316
originator:anObject
4481
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1317
    "set the originator"
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1318
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1319
    originator := anObject
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1320
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1321
    "Created: / 5.3.1998 / 16:34:56 / stefan"
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1322
!
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1323
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1324
parameter
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1325
    "return the parameter passsed with the signal raise
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1326
     (or nil, if there was none)"
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1327
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1328
    ^ parameter
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1329
!
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1330
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1331
parameter:anObject
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1332
    "set the parameter of the exception"
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1333
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1334
    parameter := anObject
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1335
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1336
    "Created: / 5.3.1998 / 16:34:22 / stefan"
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1337
!
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1338
6036
6b37c7a6f6b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5985
diff changeset
  1339
proceedable:aBoolean
6b37c7a6f6b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5985
diff changeset
  1340
    proceedable := aBoolean
6b37c7a6f6b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5985
diff changeset
  1341
!
6b37c7a6f6b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5985
diff changeset
  1342
9992
0774694cf9b3 - Add raiseContext as instance variable for faster #resume
Stefan Vogel <sv@exept.de>
parents: 9505
diff changeset
  1343
raiseContext
0774694cf9b3 - Add raiseContext as instance variable for faster #resume
Stefan Vogel <sv@exept.de>
parents: 9505
diff changeset
  1344
    ^ raiseContext
0774694cf9b3 - Add raiseContext as instance variable for faster #resume
Stefan Vogel <sv@exept.de>
parents: 9505
diff changeset
  1345
!
0774694cf9b3 - Add raiseContext as instance variable for faster #resume
Stefan Vogel <sv@exept.de>
parents: 9505
diff changeset
  1346
4481
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1347
rejected
15681
3e8d83ce8f96 class: GenericException
Claus Gittinger <cg@exept.de>
parents: 15669
diff changeset
  1348
    "return true, if any other of the exception's handlers has rejected
4481
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1349
     Uncertain, if this is really interesting to anybody.
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1350
     This is only valid during handler execution.
15681
3e8d83ce8f96 class: GenericException
Claus Gittinger <cg@exept.de>
parents: 15669
diff changeset
  1351
     (i.e. an outer handler can find out, if any other handler has already rejected).
8617
5fb5a717deff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8509
diff changeset
  1352
     Currently only used to change the 'unhandled-exception' messageText
11234
65c3be6b0d72 got rid of the \"unhandled...(\" prefix in the debugger;
Claus Gittinger <cg@exept.de>
parents: 11026
diff changeset
  1353
     into 'rejected-exception' for the information, that there was a handler which rejected.
4481
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1354
    "
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1355
4564
5401b0d1a6e3 NoHandlerSignal proceedability
Stefan Vogel <sv@exept.de>
parents: 4562
diff changeset
  1356
    ^ rejected == true
4481
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1357
!
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1358
9992
0774694cf9b3 - Add raiseContext as instance variable for faster #resume
Stefan Vogel <sv@exept.de>
parents: 9505
diff changeset
  1359
returnableSuspendedContext
0774694cf9b3 - Add raiseContext as instance variable for faster #resume
Stefan Vogel <sv@exept.de>
parents: 9505
diff changeset
  1360
    "return a nearest returnable context above suspendedContext in the sender chain.
0774694cf9b3 - Add raiseContext as instance variable for faster #resume
Stefan Vogel <sv@exept.de>
parents: 9505
diff changeset
  1361
     We know, that raiseContext is always returnable, so if suspendedContext
0774694cf9b3 - Add raiseContext as instance variable for faster #resume
Stefan Vogel <sv@exept.de>
parents: 9505
diff changeset
  1362
     is non-returnable, start there"
0774694cf9b3 - Add raiseContext as instance variable for faster #resume
Stefan Vogel <sv@exept.de>
parents: 9505
diff changeset
  1363
10389
e8972184a192 *** empty log message ***
ca
parents: 10239
diff changeset
  1364
    |returnableContext nextContext|
9992
0774694cf9b3 - Add raiseContext as instance variable for faster #resume
Stefan Vogel <sv@exept.de>
parents: 9505
diff changeset
  1365
0774694cf9b3 - Add raiseContext as instance variable for faster #resume
Stefan Vogel <sv@exept.de>
parents: 9505
diff changeset
  1366
    returnableContext := suspendedContext.
10389
e8972184a192 *** empty log message ***
ca
parents: 10239
diff changeset
  1367
    returnableContext canReturn ifFalse:[ 
9992
0774694cf9b3 - Add raiseContext as instance variable for faster #resume
Stefan Vogel <sv@exept.de>
parents: 9505
diff changeset
  1368
        "the context that triggered the exception cannot return.
0774694cf9b3 - Add raiseContext as instance variable for faster #resume
Stefan Vogel <sv@exept.de>
parents: 9505
diff changeset
  1369
         This is a fallback: return the the context of the raise*.
0774694cf9b3 - Add raiseContext as instance variable for faster #resume
Stefan Vogel <sv@exept.de>
parents: 9505
diff changeset
  1370
         We know, that this context is returnable"
0774694cf9b3 - Add raiseContext as instance variable for faster #resume
Stefan Vogel <sv@exept.de>
parents: 9505
diff changeset
  1371
0774694cf9b3 - Add raiseContext as instance variable for faster #resume
Stefan Vogel <sv@exept.de>
parents: 9505
diff changeset
  1372
        returnableContext := nextContext := raiseContext.
0774694cf9b3 - Add raiseContext as instance variable for faster #resume
Stefan Vogel <sv@exept.de>
parents: 9505
diff changeset
  1373
        "find the returnable context that is the nearest in the sender chain
0774694cf9b3 - Add raiseContext as instance variable for faster #resume
Stefan Vogel <sv@exept.de>
parents: 9505
diff changeset
  1374
         to suspendedContext...."
0774694cf9b3 - Add raiseContext as instance variable for faster #resume
Stefan Vogel <sv@exept.de>
parents: 9505
diff changeset
  1375
        [
0774694cf9b3 - Add raiseContext as instance variable for faster #resume
Stefan Vogel <sv@exept.de>
parents: 9505
diff changeset
  1376
            nextContext := nextContext sender.
0774694cf9b3 - Add raiseContext as instance variable for faster #resume
Stefan Vogel <sv@exept.de>
parents: 9505
diff changeset
  1377
            nextContext isNil ifTrue:[
0774694cf9b3 - Add raiseContext as instance variable for faster #resume
Stefan Vogel <sv@exept.de>
parents: 9505
diff changeset
  1378
                "suspendedContext appears to not exist on sender chain..."
0774694cf9b3 - Add raiseContext as instance variable for faster #resume
Stefan Vogel <sv@exept.de>
parents: 9505
diff changeset
  1379
                ^ raiseContext.
0774694cf9b3 - Add raiseContext as instance variable for faster #resume
Stefan Vogel <sv@exept.de>
parents: 9505
diff changeset
  1380
            ].
0774694cf9b3 - Add raiseContext as instance variable for faster #resume
Stefan Vogel <sv@exept.de>
parents: 9505
diff changeset
  1381
            nextContext canReturn ifTrue:[
0774694cf9b3 - Add raiseContext as instance variable for faster #resume
Stefan Vogel <sv@exept.de>
parents: 9505
diff changeset
  1382
                returnableContext := nextContext.
0774694cf9b3 - Add raiseContext as instance variable for faster #resume
Stefan Vogel <sv@exept.de>
parents: 9505
diff changeset
  1383
            ].
0774694cf9b3 - Add raiseContext as instance variable for faster #resume
Stefan Vogel <sv@exept.de>
parents: 9505
diff changeset
  1384
            nextContext ~~ suspendedContext.
0774694cf9b3 - Add raiseContext as instance variable for faster #resume
Stefan Vogel <sv@exept.de>
parents: 9505
diff changeset
  1385
        ] whileTrue.
0774694cf9b3 - Add raiseContext as instance variable for faster #resume
Stefan Vogel <sv@exept.de>
parents: 9505
diff changeset
  1386
    ].
0774694cf9b3 - Add raiseContext as instance variable for faster #resume
Stefan Vogel <sv@exept.de>
parents: 9505
diff changeset
  1387
    ^ returnableContext
0774694cf9b3 - Add raiseContext as instance variable for faster #resume
Stefan Vogel <sv@exept.de>
parents: 9505
diff changeset
  1388
!
0774694cf9b3 - Add raiseContext as instance variable for faster #resume
Stefan Vogel <sv@exept.de>
parents: 9505
diff changeset
  1389
8617
5fb5a717deff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8509
diff changeset
  1390
searchFrom:raisingContext
5697
ce78c7d9ddbd raiseSignal / raiseSignal: / raiseSignal:with:
Claus Gittinger <cg@exept.de>
parents: 5684
diff changeset
  1391
    suspendedContext := raisingContext
ce78c7d9ddbd raiseSignal / raiseSignal: / raiseSignal:with:
Claus Gittinger <cg@exept.de>
parents: 5684
diff changeset
  1392
!
ce78c7d9ddbd raiseSignal / raiseSignal: / raiseSignal:with:
Claus Gittinger <cg@exept.de>
parents: 5684
diff changeset
  1393
4481
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1394
suspendedContext
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1395
    "return the context in which the raise occured"
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1396
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1397
    ^ suspendedContext
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1398
!
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1399
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1400
suspendedContext:something
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1401
    "set the value of the instance variable 'suspendedContext' (automatically generated)"
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1402
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1403
    suspendedContext := something.
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1404
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1405
    "Created: / 2.3.1998 / 12:43:20 / stefan"
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1406
!
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1407
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1408
willProceed
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1409
    "return true, if the exception is proceedable"
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1410
4484
9476c82921d0 eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents: 4483
diff changeset
  1411
    ^ self isResumable
4481
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1412
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1413
    "Modified: / 2.3.1998 / 12:20:43 / stefan"
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1414
! !
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1415
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1416
!GenericException methodsFor:'copying'!
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1417
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1418
postCopy
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1419
    "set the internal state to nil"
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1420
9992
0774694cf9b3 - Add raiseContext as instance variable for faster #resume
Stefan Vogel <sv@exept.de>
parents: 9505
diff changeset
  1421
    raiseContext := suspendedContext := handlerContext := rejected := nil
4481
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1422
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1423
    "Created: / 2.3.1998 / 12:30:06 / stefan"
8931
10da5e5ddb8e +postDeepCopy
Claus Gittinger <cg@exept.de>
parents: 8774
diff changeset
  1424
!
10da5e5ddb8e +postDeepCopy
Claus Gittinger <cg@exept.de>
parents: 8774
diff changeset
  1425
10da5e5ddb8e +postDeepCopy
Claus Gittinger <cg@exept.de>
parents: 8774
diff changeset
  1426
postDeepCopy
10da5e5ddb8e +postDeepCopy
Claus Gittinger <cg@exept.de>
parents: 8774
diff changeset
  1427
    "set the internal state to nil"
10da5e5ddb8e +postDeepCopy
Claus Gittinger <cg@exept.de>
parents: 8774
diff changeset
  1428
10da5e5ddb8e +postDeepCopy
Claus Gittinger <cg@exept.de>
parents: 8774
diff changeset
  1429
    suspendedContext := handlerContext := rejected := nil
10da5e5ddb8e +postDeepCopy
Claus Gittinger <cg@exept.de>
parents: 8774
diff changeset
  1430
10da5e5ddb8e +postDeepCopy
Claus Gittinger <cg@exept.de>
parents: 8774
diff changeset
  1431
    "Created: / 2.3.1998 / 12:30:06 / stefan"
4481
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1432
! !
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1433
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1434
!GenericException methodsFor:'default actions'!
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1435
4527
2ddbe34bab87 Make error classes public.
Stefan Vogel <sv@exept.de>
parents: 4521
diff changeset
  1436
defaultAction
4484
9476c82921d0 eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents: 4483
diff changeset
  1437
    "perform a action for the exception if it hasn't been catched
4481
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1438
     We arrive here, if either no handler was found, or none of the
4484
9476c82921d0 eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents: 4483
diff changeset
  1439
     handlers did a return (i.e. every handler rejected).
4481
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1440
8617
5fb5a717deff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8509
diff changeset
  1441
     The default is to evaluate the signal's handlerBlock or
4562
2cd0c20d8970 Add #description, #creator
Stefan Vogel <sv@exept.de>
parents: 4556
diff changeset
  1442
     to raise the noHandlerSignal.
4481
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1443
     Subclasses may redefine this."
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1444
9992
0774694cf9b3 - Add raiseContext as instance variable for faster #resume
Stefan Vogel <sv@exept.de>
parents: 9505
diff changeset
  1445
    <context: #return>
0774694cf9b3 - Add raiseContext as instance variable for faster #resume
Stefan Vogel <sv@exept.de>
parents: 9505
diff changeset
  1446
4562
2cd0c20d8970 Add #description, #creator
Stefan Vogel <sv@exept.de>
parents: 4556
diff changeset
  1447
    |handlerBlock|
4481
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1448
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1449
    "
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1450
     try per signal handler
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1451
    "
15336
e9db6bdf3f10 class: GenericException
Stefan Vogel <sv@exept.de>
parents: 15321
diff changeset
  1452
    (handlerBlock := self creator handlerBlock) notNil ifTrue:[
8617
5fb5a717deff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8509
diff changeset
  1453
        "... and call it"
5fb5a717deff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8509
diff changeset
  1454
        ^ handlerBlock value:self.
4481
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1455
    ].
4484
9476c82921d0 eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents: 4483
diff changeset
  1456
4562
2cd0c20d8970 Add #description, #creator
Stefan Vogel <sv@exept.de>
parents: 4556
diff changeset
  1457
    ^ self noHandler.
4481
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1458
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1459
    "Created: / 23.7.1999 / 14:38:03 / stefan"
4517
8c539600fb63 Implement NoHandlerException etc. as class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4513
diff changeset
  1460
    "Modified: / 4.8.1999 / 08:11:05 / stefan"
4481
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1461
!
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1462
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1463
mayProceed
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1464
    "return true, if the exception handler is allowed to proceed
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1465
     the execution where the exception occured.
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1466
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1467
     Subclasses may redefine this."
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1468
6920
ff7892b5b41a no longer raise ProceedError
Claus Gittinger <cg@exept.de>
parents: 6859
diff changeset
  1469
    proceedable notNil ifTrue:[^ proceedable].
13009
e068f228a24b eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents: 12940
diff changeset
  1470
    signal notNil ifTrue:[^ signal mayProceed].
e068f228a24b eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents: 12940
diff changeset
  1471
    ^ self class mayProceed.
e068f228a24b eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents: 12940
diff changeset
  1472
e068f228a24b eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents: 12940
diff changeset
  1473
    "Created: / 23-07-1999 / 14:48:26 / stefan"
e068f228a24b eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents: 12940
diff changeset
  1474
    "Modified: / 10-08-2010 / 09:39:15 / cg"
4562
2cd0c20d8970 Add #description, #creator
Stefan Vogel <sv@exept.de>
parents: 4556
diff changeset
  1475
!
2cd0c20d8970 Add #description, #creator
Stefan Vogel <sv@exept.de>
parents: 4556
diff changeset
  1476
2cd0c20d8970 Add #description, #creator
Stefan Vogel <sv@exept.de>
parents: 4556
diff changeset
  1477
noHandler
2cd0c20d8970 Add #description, #creator
Stefan Vogel <sv@exept.de>
parents: 4556
diff changeset
  1478
    "raise the NoHandlerError.
2cd0c20d8970 Add #description, #creator
Stefan Vogel <sv@exept.de>
parents: 4556
diff changeset
  1479
     NohandlerError redefines this method to avoid recursive invocations"
2cd0c20d8970 Add #description, #creator
Stefan Vogel <sv@exept.de>
parents: 4556
diff changeset
  1480
4564
5401b0d1a6e3 NoHandlerSignal proceedability
Stefan Vogel <sv@exept.de>
parents: 4562
diff changeset
  1481
    <context: #return>
5401b0d1a6e3 NoHandlerSignal proceedability
Stefan Vogel <sv@exept.de>
parents: 4562
diff changeset
  1482
4562
2cd0c20d8970 Add #description, #creator
Stefan Vogel <sv@exept.de>
parents: 4556
diff changeset
  1483
    |msg|
2cd0c20d8970 Add #description, #creator
Stefan Vogel <sv@exept.de>
parents: 4556
diff changeset
  1484
4564
5401b0d1a6e3 NoHandlerSignal proceedability
Stefan Vogel <sv@exept.de>
parents: 4562
diff changeset
  1485
    rejected == true ifTrue:[
8390
d78cd984f201 return values for #proceedWith:
Stefan Vogel <sv@exept.de>
parents: 8313
diff changeset
  1486
        msg := 'unhandled (rejected)'
4562
2cd0c20d8970 Add #description, #creator
Stefan Vogel <sv@exept.de>
parents: 4556
diff changeset
  1487
    ] ifFalse:[
8390
d78cd984f201 return values for #proceedWith:
Stefan Vogel <sv@exept.de>
parents: 8313
diff changeset
  1488
        msg := 'unhandled'
4562
2cd0c20d8970 Add #description, #creator
Stefan Vogel <sv@exept.de>
parents: 4556
diff changeset
  1489
    ].
5295
f144309dab04 #errorString --> #description
Stefan Vogel <sv@exept.de>
parents: 5259
diff changeset
  1490
    msg := msg , ' exception: (' , self description , ')'.
4564
5401b0d1a6e3 NoHandlerSignal proceedability
Stefan Vogel <sv@exept.de>
parents: 4562
diff changeset
  1491
    self mayProceed ifTrue:[
8617
5fb5a717deff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8509
diff changeset
  1492
        ^ NoHandlerError
5fb5a717deff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8509
diff changeset
  1493
              raiseRequestWith:self
8390
d78cd984f201 return values for #proceedWith:
Stefan Vogel <sv@exept.de>
parents: 8313
diff changeset
  1494
              errorString:msg
d78cd984f201 return values for #proceedWith:
Stefan Vogel <sv@exept.de>
parents: 8313
diff changeset
  1495
              in:suspendedContext.
4564
5401b0d1a6e3 NoHandlerSignal proceedability
Stefan Vogel <sv@exept.de>
parents: 4562
diff changeset
  1496
    ].
8617
5fb5a717deff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8509
diff changeset
  1497
    ^ NoHandlerError
5fb5a717deff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8509
diff changeset
  1498
          raiseWith:self
8390
d78cd984f201 return values for #proceedWith:
Stefan Vogel <sv@exept.de>
parents: 8313
diff changeset
  1499
          errorString:msg
d78cd984f201 return values for #proceedWith:
Stefan Vogel <sv@exept.de>
parents: 8313
diff changeset
  1500
          in:suspendedContext.
4481
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1501
! !
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1502
5984
2d5c04c9fab6 ANSI; added #defaultResumeValue and #defaultReturnValue.
Claus Gittinger <cg@exept.de>
parents: 5950
diff changeset
  1503
!GenericException methodsFor:'default values'!
2d5c04c9fab6 ANSI; added #defaultResumeValue and #defaultReturnValue.
Claus Gittinger <cg@exept.de>
parents: 5950
diff changeset
  1504
2d5c04c9fab6 ANSI; added #defaultResumeValue and #defaultReturnValue.
Claus Gittinger <cg@exept.de>
parents: 5950
diff changeset
  1505
defaultResumeValue
2d5c04c9fab6 ANSI; added #defaultResumeValue and #defaultReturnValue.
Claus Gittinger <cg@exept.de>
parents: 5950
diff changeset
  1506
    ^ nil
2d5c04c9fab6 ANSI; added #defaultResumeValue and #defaultReturnValue.
Claus Gittinger <cg@exept.de>
parents: 5950
diff changeset
  1507
!
2d5c04c9fab6 ANSI; added #defaultResumeValue and #defaultReturnValue.
Claus Gittinger <cg@exept.de>
parents: 5950
diff changeset
  1508
2d5c04c9fab6 ANSI; added #defaultResumeValue and #defaultReturnValue.
Claus Gittinger <cg@exept.de>
parents: 5950
diff changeset
  1509
defaultReturnValue
2d5c04c9fab6 ANSI; added #defaultResumeValue and #defaultReturnValue.
Claus Gittinger <cg@exept.de>
parents: 5950
diff changeset
  1510
    ^ nil
2d5c04c9fab6 ANSI; added #defaultResumeValue and #defaultReturnValue.
Claus Gittinger <cg@exept.de>
parents: 5950
diff changeset
  1511
! !
2d5c04c9fab6 ANSI; added #defaultResumeValue and #defaultReturnValue.
Claus Gittinger <cg@exept.de>
parents: 5950
diff changeset
  1512
4481
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1513
!GenericException methodsFor:'handler actions'!
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1514
5985
4bffb803f9e8 more ANSI stuff
Claus Gittinger <cg@exept.de>
parents: 5984
diff changeset
  1515
exit
16224
2194bc886b30 class: GenericException
Claus Gittinger <cg@exept.de>
parents: 16190
diff changeset
  1516
    "either resume or return - depending on the receiver's resumability.
5985
4bffb803f9e8 more ANSI stuff
Claus Gittinger <cg@exept.de>
parents: 5984
diff changeset
  1517
     VW compatibility."
4bffb803f9e8 more ANSI stuff
Claus Gittinger <cg@exept.de>
parents: 5984
diff changeset
  1518
4bffb803f9e8 more ANSI stuff
Claus Gittinger <cg@exept.de>
parents: 5984
diff changeset
  1519
    self isResumable ifTrue:[
13803
4adfe051c944 Fix the exception handler actions (#return, #restart, ...) to work
Stefan Vogel <sv@exept.de>
parents: 13305
diff changeset
  1520
        self proceedWith:(self defaultResumeValue)
5985
4bffb803f9e8 more ANSI stuff
Claus Gittinger <cg@exept.de>
parents: 5984
diff changeset
  1521
    ] ifFalse:[
8617
5fb5a717deff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8509
diff changeset
  1522
        self return:(self defaultReturnValue)
5985
4bffb803f9e8 more ANSI stuff
Claus Gittinger <cg@exept.de>
parents: 5984
diff changeset
  1523
    ]
4bffb803f9e8 more ANSI stuff
Claus Gittinger <cg@exept.de>
parents: 5984
diff changeset
  1524
4bffb803f9e8 more ANSI stuff
Claus Gittinger <cg@exept.de>
parents: 5984
diff changeset
  1525
    "Modified: / 7.9.2001 / 13:28:54 / cg"
4bffb803f9e8 more ANSI stuff
Claus Gittinger <cg@exept.de>
parents: 5984
diff changeset
  1526
!
4bffb803f9e8 more ANSI stuff
Claus Gittinger <cg@exept.de>
parents: 5984
diff changeset
  1527
4bffb803f9e8 more ANSI stuff
Claus Gittinger <cg@exept.de>
parents: 5984
diff changeset
  1528
exit:value
16224
2194bc886b30 class: GenericException
Claus Gittinger <cg@exept.de>
parents: 16190
diff changeset
  1529
    "either resume or return - depending on the receiver's resumability.
5985
4bffb803f9e8 more ANSI stuff
Claus Gittinger <cg@exept.de>
parents: 5984
diff changeset
  1530
     VW compatibility."
4bffb803f9e8 more ANSI stuff
Claus Gittinger <cg@exept.de>
parents: 5984
diff changeset
  1531
4bffb803f9e8 more ANSI stuff
Claus Gittinger <cg@exept.de>
parents: 5984
diff changeset
  1532
    self isResumable ifTrue:[
13803
4adfe051c944 Fix the exception handler actions (#return, #restart, ...) to work
Stefan Vogel <sv@exept.de>
parents: 13305
diff changeset
  1533
        self proceedWith:value
5985
4bffb803f9e8 more ANSI stuff
Claus Gittinger <cg@exept.de>
parents: 5984
diff changeset
  1534
    ] ifFalse:[
8617
5fb5a717deff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8509
diff changeset
  1535
        self return:value
5985
4bffb803f9e8 more ANSI stuff
Claus Gittinger <cg@exept.de>
parents: 5984
diff changeset
  1536
    ]
4bffb803f9e8 more ANSI stuff
Claus Gittinger <cg@exept.de>
parents: 5984
diff changeset
  1537
4bffb803f9e8 more ANSI stuff
Claus Gittinger <cg@exept.de>
parents: 5984
diff changeset
  1538
    "Created: / 7.9.2001 / 13:29:55 / cg"
4bffb803f9e8 more ANSI stuff
Claus Gittinger <cg@exept.de>
parents: 5984
diff changeset
  1539
    "Modified: / 7.9.2001 / 13:30:00 / cg"
4bffb803f9e8 more ANSI stuff
Claus Gittinger <cg@exept.de>
parents: 5984
diff changeset
  1540
!
4bffb803f9e8 more ANSI stuff
Claus Gittinger <cg@exept.de>
parents: 5984
diff changeset
  1541
4481
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1542
proceed
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1543
    "Continue after the raise - the raise returns nil"
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1544
5984
2d5c04c9fab6 ANSI; added #defaultResumeValue and #defaultReturnValue.
Claus Gittinger <cg@exept.de>
parents: 5950
diff changeset
  1545
    self proceedWith:(self defaultResumeValue).
4481
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1546
8617
5fb5a717deff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8509
diff changeset
  1547
    "cg: a strange example:
5fb5a717deff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8509
diff changeset
  1548
        there are two cought errors here - can you spot them ?
4556
b654bb087103 new proceed code.
Claus Gittinger <cg@exept.de>
parents: 4554
diff changeset
  1549
9992
0774694cf9b3 - Add raiseContext as instance variable for faster #resume
Stefan Vogel <sv@exept.de>
parents: 9505
diff changeset
  1550
     Error handle:[:ex|
8617
5fb5a717deff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8509
diff changeset
  1551
         'proceeding' printCR.
5fb5a717deff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8509
diff changeset
  1552
         ex proceed
4484
9476c82921d0 eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents: 4483
diff changeset
  1553
     ] do:[
9992
0774694cf9b3 - Add raiseContext as instance variable for faster #resume
Stefan Vogel <sv@exept.de>
parents: 9505
diff changeset
  1554
         Error raiseRequest
4484
9476c82921d0 eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents: 4483
diff changeset
  1555
     ].
4481
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1556
    "
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1557
4517
8c539600fb63 Implement NoHandlerException etc. as class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4513
diff changeset
  1558
    "Modified: / 4.8.1999 / 08:42:12 / stefan"
5985
4bffb803f9e8 more ANSI stuff
Claus Gittinger <cg@exept.de>
parents: 5984
diff changeset
  1559
    "Modified: / 7.9.2001 / 13:29:08 / cg"
4481
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1560
!
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1561
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1562
proceedWith:value
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1563
    "Continue after the raise - the raise returns value"
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1564
9992
0774694cf9b3 - Add raiseContext as instance variable for faster #resume
Stefan Vogel <sv@exept.de>
parents: 9505
diff changeset
  1565
    |con rCon|
4484
9476c82921d0 eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents: 4483
diff changeset
  1566
15636
b9f4e2491f51 class: GenericException
Stefan Vogel <sv@exept.de>
parents: 15584
diff changeset
  1567
    (StrictRaising and:[proceedable not]) ifTrue:[
b9f4e2491f51 class: GenericException
Stefan Vogel <sv@exept.de>
parents: 15584
diff changeset
  1568
        "proceed from ProceedError to recover from this error"
b9f4e2491f51 class: GenericException
Stefan Vogel <sv@exept.de>
parents: 15584
diff changeset
  1569
        ProceedError raiseRequestWith:self.
b9f4e2491f51 class: GenericException
Stefan Vogel <sv@exept.de>
parents: 15584
diff changeset
  1570
        proceedable := true.
b9f4e2491f51 class: GenericException
Stefan Vogel <sv@exept.de>
parents: 15584
diff changeset
  1571
    ].
9992
0774694cf9b3 - Add raiseContext as instance variable for faster #resume
Stefan Vogel <sv@exept.de>
parents: 9505
diff changeset
  1572
4556
b654bb087103 new proceed code.
Claus Gittinger <cg@exept.de>
parents: 4554
diff changeset
  1573
    thisContext evaluateUnwindActionsUpTo:suspendedContext.
b654bb087103 new proceed code.
Claus Gittinger <cg@exept.de>
parents: 4554
diff changeset
  1574
9992
0774694cf9b3 - Add raiseContext as instance variable for faster #resume
Stefan Vogel <sv@exept.de>
parents: 9505
diff changeset
  1575
    con := suspendedContext.
0774694cf9b3 - Add raiseContext as instance variable for faster #resume
Stefan Vogel <sv@exept.de>
parents: 9505
diff changeset
  1576
    rCon := raiseContext.
0774694cf9b3 - Add raiseContext as instance variable for faster #resume
Stefan Vogel <sv@exept.de>
parents: 9505
diff changeset
  1577
    handlerContext := suspendedContext := raiseContext := nil.
0774694cf9b3 - Add raiseContext as instance variable for faster #resume
Stefan Vogel <sv@exept.de>
parents: 9505
diff changeset
  1578
    con resumeIgnoringErrors:value.
4481
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1579
9992
0774694cf9b3 - Add raiseContext as instance variable for faster #resume
Stefan Vogel <sv@exept.de>
parents: 9505
diff changeset
  1580
    "we arrive here, if suspendedContext is not resumable -
0774694cf9b3 - Add raiseContext as instance variable for faster #resume
Stefan Vogel <sv@exept.de>
parents: 9505
diff changeset
  1581
     resume our raise context ...
0774694cf9b3 - Add raiseContext as instance variable for faster #resume
Stefan Vogel <sv@exept.de>
parents: 9505
diff changeset
  1582
      ... consider this a fallBack kludge, for the case that
0774694cf9b3 - Add raiseContext as instance variable for faster #resume
Stefan Vogel <sv@exept.de>
parents: 9505
diff changeset
  1583
          a raising context is not returnable."
0774694cf9b3 - Add raiseContext as instance variable for faster #resume
Stefan Vogel <sv@exept.de>
parents: 9505
diff changeset
  1584
0774694cf9b3 - Add raiseContext as instance variable for faster #resume
Stefan Vogel <sv@exept.de>
parents: 9505
diff changeset
  1585
    rCon return:value.
4481
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1586
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1587
    "Modified: / 27.3.1997 / 16:45:57 / cg"
4517
8c539600fb63 Implement NoHandlerException etc. as class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4513
diff changeset
  1588
    "Modified: / 4.8.1999 / 08:42:17 / stefan"
4481
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1589
!
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1590
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1591
reject
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1592
    "handler decided not to handle this signal -
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1593
     system will look for another handler"
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1594
4484
9476c82921d0 eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents: 4483
diff changeset
  1595
    |con|
9476c82921d0 eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents: 4483
diff changeset
  1596
9992
0774694cf9b3 - Add raiseContext as instance variable for faster #resume
Stefan Vogel <sv@exept.de>
parents: 9505
diff changeset
  1597
    "find the last doCallXX: context"
4484
9476c82921d0 eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents: 4483
diff changeset
  1598
    con := Context findFirstSpecialHandle:false raise:true.
8617
5fb5a717deff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8509
diff changeset
  1599
    [con notNil
4484
9476c82921d0 eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents: 4483
diff changeset
  1600
     and:[con receiver ~~ self]] whileTrue:[
8617
5fb5a717deff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8509
diff changeset
  1601
        con := con findSpecialHandle:false raise:true.
4484
9476c82921d0 eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents: 4483
diff changeset
  1602
    ].
4481
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1603
9992
0774694cf9b3 - Add raiseContext as instance variable for faster #resume
Stefan Vogel <sv@exept.de>
parents: 9505
diff changeset
  1604
    "returning form the doCallXX: signals a reject"
4481
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1605
    rejected := true.
4484
9476c82921d0 eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents: 4483
diff changeset
  1606
    con unwind:nil.
4481
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1607
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1608
    "
11775
96ee89315d1d example
Stefan Vogel <sv@exept.de>
parents: 11710
diff changeset
  1609
     Error handle:[:ex |
8617
5fb5a717deff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8509
diff changeset
  1610
        '1' printCR.
5fb5a717deff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8509
diff changeset
  1611
        ex reject
4481
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1612
     ] do:[
11775
96ee89315d1d example
Stefan Vogel <sv@exept.de>
parents: 11710
diff changeset
  1613
        Error handle:[:ex |
8617
5fb5a717deff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8509
diff changeset
  1614
            '2' printCR.
5fb5a717deff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8509
diff changeset
  1615
            ex reject
5fb5a717deff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8509
diff changeset
  1616
        ] do:[
5fb5a717deff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8509
diff changeset
  1617
            #() at:1
5fb5a717deff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8509
diff changeset
  1618
        ]
4481
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1619
     ]
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1620
    "
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1621
!
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1622
4556
b654bb087103 new proceed code.
Claus Gittinger <cg@exept.de>
parents: 4554
diff changeset
  1623
resignalAs:anotherException
b654bb087103 new proceed code.
Claus Gittinger <cg@exept.de>
parents: 4554
diff changeset
  1624
    "resignal anotherException, as if it was raised in the first place"
b654bb087103 new proceed code.
Claus Gittinger <cg@exept.de>
parents: 4554
diff changeset
  1625
b654bb087103 new proceed code.
Claus Gittinger <cg@exept.de>
parents: 4554
diff changeset
  1626
    |con|
b654bb087103 new proceed code.
Claus Gittinger <cg@exept.de>
parents: 4554
diff changeset
  1627
9992
0774694cf9b3 - Add raiseContext as instance variable for faster #resume
Stefan Vogel <sv@exept.de>
parents: 9505
diff changeset
  1628
    con := self returnableSuspendedContext.
13803
4adfe051c944 Fix the exception handler actions (#return, #restart, ...) to work
Stefan Vogel <sv@exept.de>
parents: 13305
diff changeset
  1629
    thisContext evaluateUnwindActionsUpTo:con.
9992
0774694cf9b3 - Add raiseContext as instance variable for faster #resume
Stefan Vogel <sv@exept.de>
parents: 9505
diff changeset
  1630
    handlerContext := suspendedContext := raiseContext := nil.
13803
4adfe051c944 Fix the exception handler actions (#return, #restart, ...) to work
Stefan Vogel <sv@exept.de>
parents: 13305
diff changeset
  1631
    con returnDoing:[anotherException raiseSignal]
4556
b654bb087103 new proceed code.
Claus Gittinger <cg@exept.de>
parents: 4554
diff changeset
  1632
b654bb087103 new proceed code.
Claus Gittinger <cg@exept.de>
parents: 4554
diff changeset
  1633
    "
6364
b7d1a52ec256 Workaround for non-returnable contexts in #resignalAs:
Stefan Vogel <sv@exept.de>
parents: 6264
diff changeset
  1634
     |rslt|
b7d1a52ec256 Workaround for non-returnable contexts in #resignalAs:
Stefan Vogel <sv@exept.de>
parents: 6264
diff changeset
  1635
7753
a4de4f3a203f comments
Stefan Vogel <sv@exept.de>
parents: 7674
diff changeset
  1636
     ZeroDivide handle:[:ex |
9992
0774694cf9b3 - Add raiseContext as instance variable for faster #resume
Stefan Vogel <sv@exept.de>
parents: 9505
diff changeset
  1637
        ex resignalAs:DomainError
6364
b7d1a52ec256 Workaround for non-returnable contexts in #resignalAs:
Stefan Vogel <sv@exept.de>
parents: 6264
diff changeset
  1638
     ] do:[
8617
5fb5a717deff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8509
diff changeset
  1639
        rslt := 5 // 0
6364
b7d1a52ec256 Workaround for non-returnable contexts in #resignalAs:
Stefan Vogel <sv@exept.de>
parents: 6264
diff changeset
  1640
     ].
b7d1a52ec256 Workaround for non-returnable contexts in #resignalAs:
Stefan Vogel <sv@exept.de>
parents: 6264
diff changeset
  1641
     rslt
b7d1a52ec256 Workaround for non-returnable contexts in #resignalAs:
Stefan Vogel <sv@exept.de>
parents: 6264
diff changeset
  1642
    "
b7d1a52ec256 Workaround for non-returnable contexts in #resignalAs:
Stefan Vogel <sv@exept.de>
parents: 6264
diff changeset
  1643
b7d1a52ec256 Workaround for non-returnable contexts in #resignalAs:
Stefan Vogel <sv@exept.de>
parents: 6264
diff changeset
  1644
    "
b7d1a52ec256 Workaround for non-returnable contexts in #resignalAs:
Stefan Vogel <sv@exept.de>
parents: 6264
diff changeset
  1645
     |rslt|
4556
b654bb087103 new proceed code.
Claus Gittinger <cg@exept.de>
parents: 4554
diff changeset
  1646
7753
a4de4f3a203f comments
Stefan Vogel <sv@exept.de>
parents: 7674
diff changeset
  1647
     MessageNotUnderstood handle:[:ex |
8617
5fb5a717deff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8509
diff changeset
  1648
        ex resignalAs:Number domainErrorSignal
4556
b654bb087103 new proceed code.
Claus Gittinger <cg@exept.de>
parents: 4554
diff changeset
  1649
     ] do:[
8617
5fb5a717deff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8509
diff changeset
  1650
        rslt := 1 perform:#foo
4556
b654bb087103 new proceed code.
Claus Gittinger <cg@exept.de>
parents: 4554
diff changeset
  1651
     ].
b654bb087103 new proceed code.
Claus Gittinger <cg@exept.de>
parents: 4554
diff changeset
  1652
     rslt
b654bb087103 new proceed code.
Claus Gittinger <cg@exept.de>
parents: 4554
diff changeset
  1653
    "
12156
175e2d1a1652 comment/format in: #resignalAs:
Claus Gittinger <cg@exept.de>
parents: 12085
diff changeset
  1654
175e2d1a1652 comment/format in: #resignalAs:
Claus Gittinger <cg@exept.de>
parents: 12085
diff changeset
  1655
    "
175e2d1a1652 comment/format in: #resignalAs:
Claus Gittinger <cg@exept.de>
parents: 12085
diff changeset
  1656
     |rslt firstTime|
175e2d1a1652 comment/format in: #resignalAs:
Claus Gittinger <cg@exept.de>
parents: 12085
diff changeset
  1657
175e2d1a1652 comment/format in: #resignalAs:
Claus Gittinger <cg@exept.de>
parents: 12085
diff changeset
  1658
     firstTime := true.
175e2d1a1652 comment/format in: #resignalAs:
Claus Gittinger <cg@exept.de>
parents: 12085
diff changeset
  1659
     ZeroDivide handle:[:ex |
175e2d1a1652 comment/format in: #resignalAs:
Claus Gittinger <cg@exept.de>
parents: 12085
diff changeset
  1660
        firstTime ifTrue:[
175e2d1a1652 comment/format in: #resignalAs:
Claus Gittinger <cg@exept.de>
parents: 12085
diff changeset
  1661
            Dialog information:'again...'.
175e2d1a1652 comment/format in: #resignalAs:
Claus Gittinger <cg@exept.de>
parents: 12085
diff changeset
  1662
            firstTime := false.
175e2d1a1652 comment/format in: #resignalAs:
Claus Gittinger <cg@exept.de>
parents: 12085
diff changeset
  1663
            ex resignalAs:ZeroDivide.
175e2d1a1652 comment/format in: #resignalAs:
Claus Gittinger <cg@exept.de>
parents: 12085
diff changeset
  1664
        ].
175e2d1a1652 comment/format in: #resignalAs:
Claus Gittinger <cg@exept.de>
parents: 12085
diff changeset
  1665
        Dialog information:'arrived here again...'.
175e2d1a1652 comment/format in: #resignalAs:
Claus Gittinger <cg@exept.de>
parents: 12085
diff changeset
  1666
     ] do:[
175e2d1a1652 comment/format in: #resignalAs:
Claus Gittinger <cg@exept.de>
parents: 12085
diff changeset
  1667
        rslt := 5 // 0
175e2d1a1652 comment/format in: #resignalAs:
Claus Gittinger <cg@exept.de>
parents: 12085
diff changeset
  1668
     ].
175e2d1a1652 comment/format in: #resignalAs:
Claus Gittinger <cg@exept.de>
parents: 12085
diff changeset
  1669
     rslt
175e2d1a1652 comment/format in: #resignalAs:
Claus Gittinger <cg@exept.de>
parents: 12085
diff changeset
  1670
    "
4556
b654bb087103 new proceed code.
Claus Gittinger <cg@exept.de>
parents: 4554
diff changeset
  1671
!
b654bb087103 new proceed code.
Claus Gittinger <cg@exept.de>
parents: 4554
diff changeset
  1672
4481
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1673
restart
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1674
    "restart the handle:do: - usually after some repair work is done
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1675
     in the handler"
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1676
4484
9476c82921d0 eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents: 4483
diff changeset
  1677
    |con|
9476c82921d0 eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents: 4483
diff changeset
  1678
9476c82921d0 eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents: 4483
diff changeset
  1679
    con := handlerContext.
9992
0774694cf9b3 - Add raiseContext as instance variable for faster #resume
Stefan Vogel <sv@exept.de>
parents: 9505
diff changeset
  1680
    handlerContext := suspendedContext := raiseContext := nil.
15321
2e79d57ea5ca class: GenericException
Claus Gittinger <cg@exept.de>
parents: 15311
diff changeset
  1681
    con unwindAndRestart.
2e79d57ea5ca class: GenericException
Claus Gittinger <cg@exept.de>
parents: 15311
diff changeset
  1682
2e79d57ea5ca class: GenericException
Claus Gittinger <cg@exept.de>
parents: 15311
diff changeset
  1683
"/    thisContext evaluateUnwindActionsUpTo:con.
2e79d57ea5ca class: GenericException
Claus Gittinger <cg@exept.de>
parents: 15311
diff changeset
  1684
"/    handlerContext := suspendedContext := raiseContext := nil.
2e79d57ea5ca class: GenericException
Claus Gittinger <cg@exept.de>
parents: 15311
diff changeset
  1685
"/    con restart
4481
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1686
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1687
    "
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1688
     |rslt n|
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1689
9992
0774694cf9b3 - Add raiseContext as instance variable for faster #resume
Stefan Vogel <sv@exept.de>
parents: 9505
diff changeset
  1690
     Error handle:[:ex |
0774694cf9b3 - Add raiseContext as instance variable for faster #resume
Stefan Vogel <sv@exept.de>
parents: 9505
diff changeset
  1691
        Transcript showCR:'fixing divisor ...'.
8617
5fb5a717deff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8509
diff changeset
  1692
        n := 1.
5fb5a717deff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8509
diff changeset
  1693
        ex restart.
4481
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1694
     ] do:[
8617
5fb5a717deff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8509
diff changeset
  1695
        rslt := 5 / n.
4481
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1696
     ].
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1697
     rslt
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1698
    "
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1699
!
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1700
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1701
restartDo:aBlock
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1702
    "restart the handle:do: but execute the argument, aBlock instead of the
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1703
     original do-block - usually after some repair work is done in handler"
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1704
4484
9476c82921d0 eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents: 4483
diff changeset
  1705
    |con|
9476c82921d0 eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents: 4483
diff changeset
  1706
9476c82921d0 eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents: 4483
diff changeset
  1707
    con := handlerContext.
9476c82921d0 eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents: 4483
diff changeset
  1708
4481
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1709
"/    handlerContext unwindThenDo:[
8617
5fb5a717deff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8509
diff changeset
  1710
"/        handlerContext receiver
4481
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1711
"/            handle:(handlerContext argAt:1)
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1712
"/            do:aBlock
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1713
"/    ].
13803
4adfe051c944 Fix the exception handler actions (#return, #restart, ...) to work
Stefan Vogel <sv@exept.de>
parents: 13305
diff changeset
  1714
4544
2a0e3853d320 #returnDoing works for any exception handler.
Stefan Vogel <sv@exept.de>
parents: 4538
diff changeset
  1715
    con receiver handlerProtectedBlock:aBlock inContext:con.
15321
2e79d57ea5ca class: GenericException
Claus Gittinger <cg@exept.de>
parents: 15311
diff changeset
  1716
"/    thisContext evaluateUnwindActionsUpTo:con.
2e79d57ea5ca class: GenericException
Claus Gittinger <cg@exept.de>
parents: 15311
diff changeset
  1717
"/    handlerContext := suspendedContext := raiseContext := nil.
2e79d57ea5ca class: GenericException
Claus Gittinger <cg@exept.de>
parents: 15311
diff changeset
  1718
"/    con restart
13803
4adfe051c944 Fix the exception handler actions (#return, #restart, ...) to work
Stefan Vogel <sv@exept.de>
parents: 13305
diff changeset
  1719
    handlerContext := suspendedContext := raiseContext := nil.
15321
2e79d57ea5ca class: GenericException
Claus Gittinger <cg@exept.de>
parents: 15311
diff changeset
  1720
    con unwindAndRestart.
4481
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1721
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1722
    "
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1723
     |sig rslt|
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1724
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1725
     sig := Signal new.
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1726
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1727
     sig handle:[:ex |
9992
0774694cf9b3 - Add raiseContext as instance variable for faster #resume
Stefan Vogel <sv@exept.de>
parents: 9505
diff changeset
  1728
        Transcript showCR:'exchanging do-block ...'.
8617
5fb5a717deff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8509
diff changeset
  1729
        ex restartDo:[ rslt := 999 ]
4481
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1730
     ] do:[
8617
5fb5a717deff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8509
diff changeset
  1731
        rslt := 0.
5fb5a717deff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8509
diff changeset
  1732
        sig raise
4481
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1733
     ].
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1734
     Transcript showCR:rslt
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1735
    "
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1736
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1737
    "
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1738
     |sig rslt|
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1739
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1740
     Object errorSignal handle:[:ex |
8617
5fb5a717deff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8509
diff changeset
  1741
        ex restartDo:[ rslt := 999 ]
4481
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1742
     ] do:[
8617
5fb5a717deff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8509
diff changeset
  1743
        rslt := nil foo.
4481
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1744
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1745
     ].
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1746
     Transcript showCR:rslt
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1747
    "
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1748
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1749
    "
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1750
     |sig rslt|
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1751
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1752
     Object errorSignal handle:[:ex |
8617
5fb5a717deff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8509
diff changeset
  1753
        ex restartDo:[ 'handler' printCR. rslt := nil foo ]
4481
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1754
     ] do:[
8617
5fb5a717deff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8509
diff changeset
  1755
        rslt := nil foo.
4481
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1756
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1757
     ].
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1758
     Transcript showCR:rslt
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1759
    "
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1760
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1761
    "Modified: / 8.11.1997 / 18:52:28 / cg"
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1762
!
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1763
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1764
resume
11299
fd6de763433e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11234
diff changeset
  1765
    "Continue after the raise - the raise returns defaultResumeValue - ANSI"
fd6de763433e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11234
diff changeset
  1766
fd6de763433e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11234
diff changeset
  1767
    self proceedWith:(self defaultResumeValue)
4481
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1768
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1769
    "Modified: / 2.3.1998 / 10:51:55 / stefan"
5985
4bffb803f9e8 more ANSI stuff
Claus Gittinger <cg@exept.de>
parents: 5984
diff changeset
  1770
    "Modified: / 7.9.2001 / 13:28:34 / cg"
4bffb803f9e8 more ANSI stuff
Claus Gittinger <cg@exept.de>
parents: 5984
diff changeset
  1771
!
4bffb803f9e8 more ANSI stuff
Claus Gittinger <cg@exept.de>
parents: 5984
diff changeset
  1772
4bffb803f9e8 more ANSI stuff
Claus Gittinger <cg@exept.de>
parents: 5984
diff changeset
  1773
resume:value
9992
0774694cf9b3 - Add raiseContext as instance variable for faster #resume
Stefan Vogel <sv@exept.de>
parents: 9505
diff changeset
  1774
    "Continue after the raise - the raise returns value - ANSI"
5985
4bffb803f9e8 more ANSI stuff
Claus Gittinger <cg@exept.de>
parents: 5984
diff changeset
  1775
11299
fd6de763433e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11234
diff changeset
  1776
    self proceedWith:value
5985
4bffb803f9e8 more ANSI stuff
Claus Gittinger <cg@exept.de>
parents: 5984
diff changeset
  1777
4bffb803f9e8 more ANSI stuff
Claus Gittinger <cg@exept.de>
parents: 5984
diff changeset
  1778
    "Modified: / 7.9.2001 / 13:28:49 / cg"
4481
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1779
!
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1780
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1781
resumeWith:value
9992
0774694cf9b3 - Add raiseContext as instance variable for faster #resume
Stefan Vogel <sv@exept.de>
parents: 9505
diff changeset
  1782
    "Continue after the raise - the raise returns value - ANSI"
8617
5fb5a717deff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8509
diff changeset
  1783
11299
fd6de763433e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11234
diff changeset
  1784
    self proceedWith:value
4481
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1785
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1786
    "Modified: / 2.3.1998 / 10:51:48 / stefan"
5985
4bffb803f9e8 more ANSI stuff
Claus Gittinger <cg@exept.de>
parents: 5984
diff changeset
  1787
    "Modified: / 7.9.2001 / 13:29:26 / cg"
4481
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1788
!
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1789
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1790
return
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1791
    "Continue after the handle:do: - the handle:do: returns nil"
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1792
15321
2e79d57ea5ca class: GenericException
Claus Gittinger <cg@exept.de>
parents: 15311
diff changeset
  1793
    |con value|
4481
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1794
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1795
    con := handlerContext.
15261
a4b1efbb3750 class: GenericException
Claus Gittinger <cg@exept.de>
parents: 15237
diff changeset
  1796
    "/ cg: moving the following clearing of the handlerContext
a4b1efbb3750 class: GenericException
Claus Gittinger <cg@exept.de>
parents: 15237
diff changeset
  1797
    "/ to before the evalUnwindActions allows for the exception
a4b1efbb3750 class: GenericException
Claus Gittinger <cg@exept.de>
parents: 15237
diff changeset
  1798
    "/ to be handled during the unwind.
a4b1efbb3750 class: GenericException
Claus Gittinger <cg@exept.de>
parents: 15237
diff changeset
  1799
    "/ It can be discussed, whether this is correct or not;
a4b1efbb3750 class: GenericException
Claus Gittinger <cg@exept.de>
parents: 15237
diff changeset
  1800
    "/ I think, that the unwind actions should behave just the same as
a4b1efbb3750 class: GenericException
Claus Gittinger <cg@exept.de>
parents: 15237
diff changeset
  1801
    "/ when a normal return is done. As unwind actions are called,
a4b1efbb3750 class: GenericException
Claus Gittinger <cg@exept.de>
parents: 15237
diff changeset
  1802
    "/ these are unmarkedForUnwind anyway, so there should be no danger
a4b1efbb3750 class: GenericException
Claus Gittinger <cg@exept.de>
parents: 15237
diff changeset
  1803
    "/ for endless recursion here... (i.e. each unwind action can at most
a4b1efbb3750 class: GenericException
Claus Gittinger <cg@exept.de>
parents: 15237
diff changeset
  1804
    "/ reraise that exception once).
15321
2e79d57ea5ca class: GenericException
Claus Gittinger <cg@exept.de>
parents: 15311
diff changeset
  1805
    value := self defaultReturnValue.   "/ evaluate before unwinding
15261
a4b1efbb3750 class: GenericException
Claus Gittinger <cg@exept.de>
parents: 15237
diff changeset
  1806
    handlerContext := suspendedContext := raiseContext := nil.
13803
4adfe051c944 Fix the exception handler actions (#return, #restart, ...) to work
Stefan Vogel <sv@exept.de>
parents: 13305
diff changeset
  1807
    thisContext evaluateUnwindActionsUpTo:con.
15261
a4b1efbb3750 class: GenericException
Claus Gittinger <cg@exept.de>
parents: 15237
diff changeset
  1808
    "/ handlerContext := suspendedContext := raiseContext := nil.
15321
2e79d57ea5ca class: GenericException
Claus Gittinger <cg@exept.de>
parents: 15311
diff changeset
  1809
    con return:value
4481
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1810
5985
4bffb803f9e8 more ANSI stuff
Claus Gittinger <cg@exept.de>
parents: 5984
diff changeset
  1811
    "Modified: / 7.9.2001 / 13:29:34 / cg"
4481
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1812
!
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1813
5939
cd677568dca6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5933
diff changeset
  1814
return:value
cd677568dca6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5933
diff changeset
  1815
    "Continue after the handle:do: - the handle:do: returns value"
cd677568dca6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5933
diff changeset
  1816
cd677568dca6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5933
diff changeset
  1817
    |con|
cd677568dca6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5933
diff changeset
  1818
cd677568dca6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5933
diff changeset
  1819
    con := handlerContext.
15261
a4b1efbb3750 class: GenericException
Claus Gittinger <cg@exept.de>
parents: 15237
diff changeset
  1820
    "/ cg: moving the following clearing of the handlerContext
a4b1efbb3750 class: GenericException
Claus Gittinger <cg@exept.de>
parents: 15237
diff changeset
  1821
    "/ to before the evalUnwindActions allows for the exception
a4b1efbb3750 class: GenericException
Claus Gittinger <cg@exept.de>
parents: 15237
diff changeset
  1822
    "/ to be handled during the unwind.
a4b1efbb3750 class: GenericException
Claus Gittinger <cg@exept.de>
parents: 15237
diff changeset
  1823
    "/ It can be discussed, whether this is correct or not;
a4b1efbb3750 class: GenericException
Claus Gittinger <cg@exept.de>
parents: 15237
diff changeset
  1824
    "/ I think, that the unwind actions should behave just the same as
a4b1efbb3750 class: GenericException
Claus Gittinger <cg@exept.de>
parents: 15237
diff changeset
  1825
    "/ when a normal return is done. As unwind actions are called,
a4b1efbb3750 class: GenericException
Claus Gittinger <cg@exept.de>
parents: 15237
diff changeset
  1826
    "/ these are unmarkedForUnwind anyway, so there should be no danger
a4b1efbb3750 class: GenericException
Claus Gittinger <cg@exept.de>
parents: 15237
diff changeset
  1827
    "/ for endless recursion here... (i.e. each unwind action can at most
a4b1efbb3750 class: GenericException
Claus Gittinger <cg@exept.de>
parents: 15237
diff changeset
  1828
    "/ reraise that exception once).
a4b1efbb3750 class: GenericException
Claus Gittinger <cg@exept.de>
parents: 15237
diff changeset
  1829
    handlerContext := suspendedContext := raiseContext := nil.
13803
4adfe051c944 Fix the exception handler actions (#return, #restart, ...) to work
Stefan Vogel <sv@exept.de>
parents: 13305
diff changeset
  1830
    thisContext evaluateUnwindActionsUpTo:con.
15261
a4b1efbb3750 class: GenericException
Claus Gittinger <cg@exept.de>
parents: 15237
diff changeset
  1831
    "/ handlerContext := suspendedContext := raiseContext := nil.
13803
4adfe051c944 Fix the exception handler actions (#return, #restart, ...) to work
Stefan Vogel <sv@exept.de>
parents: 13305
diff changeset
  1832
    con return:value.
5939
cd677568dca6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5933
diff changeset
  1833
cd677568dca6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5933
diff changeset
  1834
    "Modified: 27.3.1997 / 16:46:51 / cg"
cd677568dca6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5933
diff changeset
  1835
!
cd677568dca6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5933
diff changeset
  1836
4481
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1837
returnDoing:aBlock
4544
2a0e3853d320 #returnDoing works for any exception handler.
Stefan Vogel <sv@exept.de>
parents: 4538
diff changeset
  1838
    "Continue after the handle:do: - the handle:do: returns aBlock value
2a0e3853d320 #returnDoing works for any exception handler.
Stefan Vogel <sv@exept.de>
parents: 4538
diff changeset
  1839
     Be careful when debugging. You cannot see the context with #returnDoing:
2a0e3853d320 #returnDoing works for any exception handler.
Stefan Vogel <sv@exept.de>
parents: 4538
diff changeset
  1840
     in the debugger if aBlock raises a signal"
4481
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1841
4484
9476c82921d0 eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents: 4483
diff changeset
  1842
    |con|
9476c82921d0 eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents: 4483
diff changeset
  1843
9476c82921d0 eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents: 4483
diff changeset
  1844
    con := handlerContext.
15261
a4b1efbb3750 class: GenericException
Claus Gittinger <cg@exept.de>
parents: 15237
diff changeset
  1845
    "/ cg: moving the following clearing of the handlerContext
a4b1efbb3750 class: GenericException
Claus Gittinger <cg@exept.de>
parents: 15237
diff changeset
  1846
    "/ to before the evalUnwindActions allows for the exception
a4b1efbb3750 class: GenericException
Claus Gittinger <cg@exept.de>
parents: 15237
diff changeset
  1847
    "/ to be handled during the unwind.
a4b1efbb3750 class: GenericException
Claus Gittinger <cg@exept.de>
parents: 15237
diff changeset
  1848
    "/ It can be discussed, whether this is correct or not;
a4b1efbb3750 class: GenericException
Claus Gittinger <cg@exept.de>
parents: 15237
diff changeset
  1849
    "/ I think, that the unwind actions should behave just the same as
a4b1efbb3750 class: GenericException
Claus Gittinger <cg@exept.de>
parents: 15237
diff changeset
  1850
    "/ when a normal return is done. As unwind actions are called,
a4b1efbb3750 class: GenericException
Claus Gittinger <cg@exept.de>
parents: 15237
diff changeset
  1851
    "/ these are unmarkedForUnwind anyway, so there should be no danger
a4b1efbb3750 class: GenericException
Claus Gittinger <cg@exept.de>
parents: 15237
diff changeset
  1852
    "/ for endless recursion here... (i.e. each unwind action can at most
a4b1efbb3750 class: GenericException
Claus Gittinger <cg@exept.de>
parents: 15237
diff changeset
  1853
    "/ reraise that exception once).
a4b1efbb3750 class: GenericException
Claus Gittinger <cg@exept.de>
parents: 15237
diff changeset
  1854
    handlerContext := suspendedContext := raiseContext := nil.
13803
4adfe051c944 Fix the exception handler actions (#return, #restart, ...) to work
Stefan Vogel <sv@exept.de>
parents: 13305
diff changeset
  1855
    thisContext evaluateUnwindActionsUpTo:con.
15261
a4b1efbb3750 class: GenericException
Claus Gittinger <cg@exept.de>
parents: 15237
diff changeset
  1856
    "/ handlerContext := suspendedContext := raiseContext := nil.
13803
4adfe051c944 Fix the exception handler actions (#return, #restart, ...) to work
Stefan Vogel <sv@exept.de>
parents: 13305
diff changeset
  1857
    con returnDoing:aBlock
9992
0774694cf9b3 - Add raiseContext as instance variable for faster #resume
Stefan Vogel <sv@exept.de>
parents: 9505
diff changeset
  1858
0774694cf9b3 - Add raiseContext as instance variable for faster #resume
Stefan Vogel <sv@exept.de>
parents: 9505
diff changeset
  1859
    "
0774694cf9b3 - Add raiseContext as instance variable for faster #resume
Stefan Vogel <sv@exept.de>
parents: 9505
diff changeset
  1860
        [
0774694cf9b3 - Add raiseContext as instance variable for faster #resume
Stefan Vogel <sv@exept.de>
parents: 9505
diff changeset
  1861
            5 // 0
0774694cf9b3 - Add raiseContext as instance variable for faster #resume
Stefan Vogel <sv@exept.de>
parents: 9505
diff changeset
  1862
        ] on:Error do:[:ex|
0774694cf9b3 - Add raiseContext as instance variable for faster #resume
Stefan Vogel <sv@exept.de>
parents: 9505
diff changeset
  1863
            ex returnDoing:[self halt. 47*11].
0774694cf9b3 - Add raiseContext as instance variable for faster #resume
Stefan Vogel <sv@exept.de>
parents: 9505
diff changeset
  1864
        ]
0774694cf9b3 - Add raiseContext as instance variable for faster #resume
Stefan Vogel <sv@exept.de>
parents: 9505
diff changeset
  1865
    "
4481
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1866
!
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1867
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1868
returnWith:value
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1869
    "Continue after the handle:do: - the handle:do: returns value"
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1870
5939
cd677568dca6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5933
diff changeset
  1871
    self return:value
4481
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1872
! !
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1873
5570
e6e14f50d721 category change
Claus Gittinger <cg@exept.de>
parents: 5348
diff changeset
  1874
!GenericException methodsFor:'printing & storing'!
4562
2cd0c20d8970 Add #description, #creator
Stefan Vogel <sv@exept.de>
parents: 4556
diff changeset
  1875
2cd0c20d8970 Add #description, #creator
Stefan Vogel <sv@exept.de>
parents: 4556
diff changeset
  1876
description
2cd0c20d8970 Add #description, #creator
Stefan Vogel <sv@exept.de>
parents: 4556
diff changeset
  1877
    "return the description string of the signal"
2cd0c20d8970 Add #description, #creator
Stefan Vogel <sv@exept.de>
parents: 4556
diff changeset
  1878
6248
1898c39ebdfa care for non-string description
Claus Gittinger <cg@exept.de>
parents: 6246
diff changeset
  1879
    |sigDescr|
1898c39ebdfa care for non-string description
Claus Gittinger <cg@exept.de>
parents: 6246
diff changeset
  1880
15336
e9db6bdf3f10 class: GenericException
Stefan Vogel <sv@exept.de>
parents: 15321
diff changeset
  1881
    sigDescr := self creator description.
e9db6bdf3f10 class: GenericException
Stefan Vogel <sv@exept.de>
parents: 15321
diff changeset
  1882
    (messageText isNil or:[messageText isString not])
6248
1898c39ebdfa care for non-string description
Claus Gittinger <cg@exept.de>
parents: 6246
diff changeset
  1883
    ifTrue:[
8617
5fb5a717deff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8509
diff changeset
  1884
        ^ sigDescr
4562
2cd0c20d8970 Add #description, #creator
Stefan Vogel <sv@exept.de>
parents: 4556
diff changeset
  1885
    ].
8313
2aa626e8e404 Fix do not execute an exception handler inside the do-block, when the
Stefan Vogel <sv@exept.de>
parents: 8254
diff changeset
  1886
    (messageText startsWith:Character space) ifTrue:[
8617
5fb5a717deff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8509
diff changeset
  1887
        ^ sigDescr, messageText.
4562
2cd0c20d8970 Add #description, #creator
Stefan Vogel <sv@exept.de>
parents: 4556
diff changeset
  1888
    ].
8313
2aa626e8e404 Fix do not execute an exception handler inside the do-block, when the
Stefan Vogel <sv@exept.de>
parents: 8254
diff changeset
  1889
    (messageText endsWith:Character space) ifTrue:[
8617
5fb5a717deff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8509
diff changeset
  1890
        ^ messageText, sigDescr.
4562
2cd0c20d8970 Add #description, #creator
Stefan Vogel <sv@exept.de>
parents: 4556
diff changeset
  1891
    ].
2cd0c20d8970 Add #description, #creator
Stefan Vogel <sv@exept.de>
parents: 4556
diff changeset
  1892
8313
2aa626e8e404 Fix do not execute an exception handler inside the do-block, when the
Stefan Vogel <sv@exept.de>
parents: 8254
diff changeset
  1893
    ^ messageText
4562
2cd0c20d8970 Add #description, #creator
Stefan Vogel <sv@exept.de>
parents: 4556
diff changeset
  1894
2cd0c20d8970 Add #description, #creator
Stefan Vogel <sv@exept.de>
parents: 4556
diff changeset
  1895
    "
2cd0c20d8970 Add #description, #creator
Stefan Vogel <sv@exept.de>
parents: 4556
diff changeset
  1896
      (Error new messageText:'bla') description
2cd0c20d8970 Add #description, #creator
Stefan Vogel <sv@exept.de>
parents: 4556
diff changeset
  1897
      (Error new messageText:' bla') description
2cd0c20d8970 Add #description, #creator
Stefan Vogel <sv@exept.de>
parents: 4556
diff changeset
  1898
      (Error new messageText:'bla ') description
2cd0c20d8970 Add #description, #creator
Stefan Vogel <sv@exept.de>
parents: 4556
diff changeset
  1899
    "
2cd0c20d8970 Add #description, #creator
Stefan Vogel <sv@exept.de>
parents: 4556
diff changeset
  1900
2cd0c20d8970 Add #description, #creator
Stefan Vogel <sv@exept.de>
parents: 4556
diff changeset
  1901
    "Modified: / 12.3.1998 / 15:13:28 / stefan"
6859
5ef85865e8db Print exception description with #printOn:
Stefan Vogel <sv@exept.de>
parents: 6630
diff changeset
  1902
!
5ef85865e8db Print exception description with #printOn:
Stefan Vogel <sv@exept.de>
parents: 6630
diff changeset
  1903
11234
65c3be6b0d72 got rid of the \"unhandled...(\" prefix in the debugger;
Claus Gittinger <cg@exept.de>
parents: 11026
diff changeset
  1904
descriptionForDebugger
65c3be6b0d72 got rid of the \"unhandled...(\" prefix in the debugger;
Claus Gittinger <cg@exept.de>
parents: 11026
diff changeset
  1905
    "return the description string of the signal which is used in the 
65c3be6b0d72 got rid of the \"unhandled...(\" prefix in the debugger;
Claus Gittinger <cg@exept.de>
parents: 11026
diff changeset
  1906
     debugger title area"
65c3be6b0d72 got rid of the \"unhandled...(\" prefix in the debugger;
Claus Gittinger <cg@exept.de>
parents: 11026
diff changeset
  1907
65c3be6b0d72 got rid of the \"unhandled...(\" prefix in the debugger;
Claus Gittinger <cg@exept.de>
parents: 11026
diff changeset
  1908
    ^ self description.
65c3be6b0d72 got rid of the \"unhandled...(\" prefix in the debugger;
Claus Gittinger <cg@exept.de>
parents: 11026
diff changeset
  1909
!
65c3be6b0d72 got rid of the \"unhandled...(\" prefix in the debugger;
Claus Gittinger <cg@exept.de>
parents: 11026
diff changeset
  1910
6859
5ef85865e8db Print exception description with #printOn:
Stefan Vogel <sv@exept.de>
parents: 6630
diff changeset
  1911
printOn:aStream
8941
4b4c238d0e7b #printOn: and #printString now print the description (without "an Error())
Stefan Vogel <sv@exept.de>
parents: 8931
diff changeset
  1912
    aStream nextPutAll:self description
4562
2cd0c20d8970 Add #description, #creator
Stefan Vogel <sv@exept.de>
parents: 4556
diff changeset
  1913
! !
2cd0c20d8970 Add #description, #creator
Stefan Vogel <sv@exept.de>
parents: 4556
diff changeset
  1914
4481
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1915
!GenericException methodsFor:'private'!
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1916
13009
e068f228a24b eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents: 12940
diff changeset
  1917
checkProceedable
e068f228a24b eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents: 12940
diff changeset
  1918
    "helper for all raiseRequest methods"
e068f228a24b eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents: 12940
diff changeset
  1919
e068f228a24b eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents: 12940
diff changeset
  1920
    self mayProceed ifFalse:[
e068f228a24b eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents: 12940
diff changeset
  1921
        StrictRaising ifTrue:[
e068f228a24b eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents: 12940
diff changeset
  1922
            "/ proceeding from wrongProceedabilitySignal grants the raiseRequest
15336
e9db6bdf3f10 class: GenericException
Stefan Vogel <sv@exept.de>
parents: 15321
diff changeset
  1923
            WrongProceedabilityError raiseRequestWith:self creator.
13009
e068f228a24b eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents: 12940
diff changeset
  1924
        ] ifFalse:[
e068f228a24b eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents: 12940
diff changeset
  1925
            self class name infoPrint.
e068f228a24b eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents: 12940
diff changeset
  1926
            ' [warning]: raised with wrong proceedability' infoPrintCR.
e068f228a24b eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents: 12940
diff changeset
  1927
        ]
e068f228a24b eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents: 12940
diff changeset
  1928
    ].
e068f228a24b eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents: 12940
diff changeset
  1929
e068f228a24b eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents: 12940
diff changeset
  1930
    "Created: / 10-08-2010 / 09:54:41 / cg"
e068f228a24b eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents: 12940
diff changeset
  1931
!
e068f228a24b eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents: 12940
diff changeset
  1932
4484
9476c82921d0 eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents: 4483
diff changeset
  1933
doCallAction
8617
5fb5a717deff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8509
diff changeset
  1934
    "call the action proper
4484
9476c82921d0 eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents: 4483
diff changeset
  1935
     - needed an extra method to have a raise-marked context around
15669
7f38f4a9fd43 class: GenericException
Claus Gittinger <cg@exept.de>
parents: 15636
diff changeset
  1936
       i.e. do not inline this into #doRaise !! 
7f38f4a9fd43 class: GenericException
Claus Gittinger <cg@exept.de>
parents: 15636
diff changeset
  1937
       (see implementation of #reject and #proceed)."
4484
9476c82921d0 eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents: 4483
diff changeset
  1938
4488
db914d752859 must mark returned contexts as returnable
Claus Gittinger <cg@exept.de>
parents: 4484
diff changeset
  1939
    <context: #return>
db914d752859 must mark returned contexts as returnable
Claus Gittinger <cg@exept.de>
parents: 4484
diff changeset
  1940
    <exception: #raise>
db914d752859 must mark returned contexts as returnable
Claus Gittinger <cg@exept.de>
parents: 4484
diff changeset
  1941
4527
2ddbe34bab87 Make error classes public.
Stefan Vogel <sv@exept.de>
parents: 4521
diff changeset
  1942
    ^ self defaultAction
4484
9476c82921d0 eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents: 4483
diff changeset
  1943
!
9476c82921d0 eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents: 4483
diff changeset
  1944
4481
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1945
doCallHandler:aHandlerBlock
15692
a88a02fdd218 class: GenericException
Claus Gittinger <cg@exept.de>
parents: 15681
diff changeset
  1946
    "call the handler proper - if the handler falls through, return the handler's value
8691
8b83b6cb00ac Use #argumentCount instead of #numArgs in #doCallHandler: - it is implemented in Object
Stefan Vogel <sv@exept.de>
parents: 8684
diff changeset
  1947
     - an extra method is needed to have a raise-marked context around.
15669
7f38f4a9fd43 class: GenericException
Claus Gittinger <cg@exept.de>
parents: 15636
diff changeset
  1948
       i.e. do not inline this into #doRaise !! 
7f38f4a9fd43 class: GenericException
Claus Gittinger <cg@exept.de>
parents: 15636
diff changeset
  1949
       (see implementation of #reject and #proceed).
7f38f4a9fd43 class: GenericException
Claus Gittinger <cg@exept.de>
parents: 15636
diff changeset
  1950
     - also redefinable (see CascadingNotification)"
4481
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1951
4488
db914d752859 must mark returned contexts as returnable
Claus Gittinger <cg@exept.de>
parents: 4484
diff changeset
  1952
    <context: #return>
db914d752859 must mark returned contexts as returnable
Claus Gittinger <cg@exept.de>
parents: 4484
diff changeset
  1953
    <exception: #raise>
db914d752859 must mark returned contexts as returnable
Claus Gittinger <cg@exept.de>
parents: 4484
diff changeset
  1954
4481
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1955
    |val|
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1956
8691
8b83b6cb00ac Use #argumentCount instead of #numArgs in #doCallHandler: - it is implemented in Object
Stefan Vogel <sv@exept.de>
parents: 8684
diff changeset
  1957
    aHandlerBlock argumentCount == 0 ifTrue:[
11640
2df4e81e1dbd changed #handlerForSignal:context:originator:
Stefan Vogel <sv@exept.de>
parents: 11621
diff changeset
  1958
        "0-arg handler or any object - not interested in the exception argument"
8313
2aa626e8e404 Fix do not execute an exception handler inside the do-block, when the
Stefan Vogel <sv@exept.de>
parents: 8254
diff changeset
  1959
        val := aHandlerBlock value
6158
7fb96896ed4b support 0-arg handler blocks
Claus Gittinger <cg@exept.de>
parents: 6036
diff changeset
  1960
    ] ifFalse:[
11640
2df4e81e1dbd changed #handlerForSignal:context:originator:
Stefan Vogel <sv@exept.de>
parents: 11621
diff changeset
  1961
        "1-arg handler - pass myself as exception argument"
8313
2aa626e8e404 Fix do not execute an exception handler inside the do-block, when the
Stefan Vogel <sv@exept.de>
parents: 8254
diff changeset
  1962
        val := aHandlerBlock value:self.
6158
7fb96896ed4b support 0-arg handler blocks
Claus Gittinger <cg@exept.de>
parents: 6036
diff changeset
  1963
    ].
7fb96896ed4b support 0-arg handler blocks
Claus Gittinger <cg@exept.de>
parents: 6036
diff changeset
  1964
8691
8b83b6cb00ac Use #argumentCount instead of #numArgs in #doCallHandler: - it is implemented in Object
Stefan Vogel <sv@exept.de>
parents: 8684
diff changeset
  1965
    "handler fall through - is just like a #return:(aHandlerBlock value)"
4481
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1966
8691
8b83b6cb00ac Use #argumentCount instead of #numArgs in #doCallHandler: - it is implemented in Object
Stefan Vogel <sv@exept.de>
parents: 8684
diff changeset
  1967
    self return:val
4481
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1968
!
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1969
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1970
doRaise
8617
5fb5a717deff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8509
diff changeset
  1971
    "search through the context-calling chain for a handle-context
5fb5a717deff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8509
diff changeset
  1972
     to the raising signal, a parent of it, or a SignalSet which includes
4481
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1973
     the raising signal.
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1974
     If found, ask the receiver for the handler and evaluate
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1975
     it with the receiver exception as argument.
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1976
     If no handler is found, perform the default #action method.
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1977
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1978
     ATTENTION: the code below depends on being called by #raise or
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1979
     #raiseRequest for proper operation (it skips the sending context)."
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1980
4488
db914d752859 must mark returned contexts as returnable
Claus Gittinger <cg@exept.de>
parents: 4484
diff changeset
  1981
    <context: #return>
db914d752859 must mark returned contexts as returnable
Claus Gittinger <cg@exept.de>
parents: 4484
diff changeset
  1982
8313
2aa626e8e404 Fix do not execute an exception handler inside the do-block, when the
Stefan Vogel <sv@exept.de>
parents: 8254
diff changeset
  1983
    |currentContext|
2aa626e8e404 Fix do not execute an exception handler inside the do-block, when the
Stefan Vogel <sv@exept.de>
parents: 8254
diff changeset
  1984
2aa626e8e404 Fix do not execute an exception handler inside the do-block, when the
Stefan Vogel <sv@exept.de>
parents: 8254
diff changeset
  1985
    "is nil a valid originator? If so, we need an extra
2aa626e8e404 Fix do not execute an exception handler inside the do-block, when the
Stefan Vogel <sv@exept.de>
parents: 8254
diff changeset
  1986
     instanceVariable to record the originator setting"
4481
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1987
    originator isNil ifTrue:[
8313
2aa626e8e404 Fix do not execute an exception handler inside the do-block, when the
Stefan Vogel <sv@exept.de>
parents: 8254
diff changeset
  1988
        originator := suspendedContext homeReceiver
4481
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1989
    ].
15336
e9db6bdf3f10 class: GenericException
Stefan Vogel <sv@exept.de>
parents: 15321
diff changeset
  1990
13009
e068f228a24b eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents: 12940
diff changeset
  1991
    signal isNil ifTrue:[
e068f228a24b eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents: 12940
diff changeset
  1992
        signal := self class
e068f228a24b eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents: 12940
diff changeset
  1993
    ] ifFalse:[
e068f228a24b eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents: 12940
diff changeset
  1994
        signal isExceptionCreator ifFalse:[
e068f228a24b eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents: 12940
diff changeset
  1995
            "not an exception or Signal - there is something wrong here..."
15336
e9db6bdf3f10 class: GenericException
Stefan Vogel <sv@exept.de>
parents: 15321
diff changeset
  1996
            SignalError raiseWith:signal errorString:'unexpected non-ExceptionCreator in calling context'.
13009
e068f228a24b eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents: 12940
diff changeset
  1997
        ]
4481
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1998
    ].
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1999
8313
2aa626e8e404 Fix do not execute an exception handler inside the do-block, when the
Stefan Vogel <sv@exept.de>
parents: 8254
diff changeset
  2000
    "now, start searching for a handler.
2aa626e8e404 Fix do not execute an exception handler inside the do-block, when the
Stefan Vogel <sv@exept.de>
parents: 8254
diff changeset
  2001
     Start search above the last active handler.
2aa626e8e404 Fix do not execute an exception handler inside the do-block, when the
Stefan Vogel <sv@exept.de>
parents: 8254
diff changeset
  2002
     Skip raise contexts.
2aa626e8e404 Fix do not execute an exception handler inside the do-block, when the
Stefan Vogel <sv@exept.de>
parents: 8254
diff changeset
  2003
     If nil, then there is no handler and we can directly proceed
2aa626e8e404 Fix do not execute an exception handler inside the do-block, when the
Stefan Vogel <sv@exept.de>
parents: 8254
diff changeset
  2004
     to the unhandled code below."
2aa626e8e404 Fix do not execute an exception handler inside the do-block, when the
Stefan Vogel <sv@exept.de>
parents: 8254
diff changeset
  2005
2aa626e8e404 Fix do not execute an exception handler inside the do-block, when the
Stefan Vogel <sv@exept.de>
parents: 8254
diff changeset
  2006
    currentContext := suspendedContext findExceptional.
2aa626e8e404 Fix do not execute an exception handler inside the do-block, when the
Stefan Vogel <sv@exept.de>
parents: 8254
diff changeset
  2007
    [currentContext notNil] whileTrue:[
8617
5fb5a717deff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8509
diff changeset
  2008
        (currentContext isRaiseContext) ifTrue:[
8313
2aa626e8e404 Fix do not execute an exception handler inside the do-block, when the
Stefan Vogel <sv@exept.de>
parents: 8254
diff changeset
  2009
            |ex1 con1|
2aa626e8e404 Fix do not execute an exception handler inside the do-block, when the
Stefan Vogel <sv@exept.de>
parents: 8254
diff changeset
  2010
2aa626e8e404 Fix do not execute an exception handler inside the do-block, when the
Stefan Vogel <sv@exept.de>
parents: 8254
diff changeset
  2011
            "skip all the contexts between the raise and the sender of #handle:do"
2aa626e8e404 Fix do not execute an exception handler inside the do-block, when the
Stefan Vogel <sv@exept.de>
parents: 8254
diff changeset
  2012
            ex1 := currentContext receiver.     "exception, that has been raised"
2aa626e8e404 Fix do not execute an exception handler inside the do-block, when the
Stefan Vogel <sv@exept.de>
parents: 8254
diff changeset
  2013
            con1 := ex1 handlerContext.         "the context of the #handle:do:"
2aa626e8e404 Fix do not execute an exception handler inside the do-block, when the
Stefan Vogel <sv@exept.de>
parents: 8254
diff changeset
  2014
8617
5fb5a717deff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8509
diff changeset
  2015
            con1 isNil ifTrue:[
8313
2aa626e8e404 Fix do not execute an exception handler inside the do-block, when the
Stefan Vogel <sv@exept.de>
parents: 8254
diff changeset
  2016
                "the handlerContext is nil if an exception's default action is performed.
2aa626e8e404 Fix do not execute an exception handler inside the do-block, when the
Stefan Vogel <sv@exept.de>
parents: 8254
diff changeset
  2017
                 Start search at the sending context.
2aa626e8e404 Fix do not execute an exception handler inside the do-block, when the
Stefan Vogel <sv@exept.de>
parents: 8254
diff changeset
  2018
                 Maybe we should better treat a default action like a #handle:do:
2aa626e8e404 Fix do not execute an exception handler inside the do-block, when the
Stefan Vogel <sv@exept.de>
parents: 8254
diff changeset
  2019
                 at the outest level. But the DebugView currently can't handle this,
2aa626e8e404 Fix do not execute an exception handler inside the do-block, when the
Stefan Vogel <sv@exept.de>
parents: 8254
diff changeset
  2020
                 because it tries to raise e.g. AbortOperationRequest even if it has bee invoked
15336
e9db6bdf3f10 class: GenericException
Stefan Vogel <sv@exept.de>
parents: 15321
diff changeset
  2021
                 by e.g. NoHandlerError.
e9db6bdf3f10 class: GenericException
Stefan Vogel <sv@exept.de>
parents: 15321
diff changeset
  2022
e9db6bdf3f10 class: GenericException
Stefan Vogel <sv@exept.de>
parents: 15321
diff changeset
  2023
                 Note that if raiseContext is nil, the exception
e9db6bdf3f10 class: GenericException
Stefan Vogel <sv@exept.de>
parents: 15321
diff changeset
  2024
                 did already return."
e9db6bdf3f10 class: GenericException
Stefan Vogel <sv@exept.de>
parents: 15321
diff changeset
  2025
e9db6bdf3f10 class: GenericException
Stefan Vogel <sv@exept.de>
parents: 15321
diff changeset
  2026
                (ex1 creator == signal and:[ex1 raiseContext notNil]) ifTrue:[
8313
2aa626e8e404 Fix do not execute an exception handler inside the do-block, when the
Stefan Vogel <sv@exept.de>
parents: 8254
diff changeset
  2027
                    "the same exception that has been cought by a default action is raised again.
2aa626e8e404 Fix do not execute an exception handler inside the do-block, when the
Stefan Vogel <sv@exept.de>
parents: 8254
diff changeset
  2028
                     don't recurse"
2aa626e8e404 Fix do not execute an exception handler inside the do-block, when the
Stefan Vogel <sv@exept.de>
parents: 8254
diff changeset
  2029
                    ^ self noHandler.
2aa626e8e404 Fix do not execute an exception handler inside the do-block, when the
Stefan Vogel <sv@exept.de>
parents: 8254
diff changeset
  2030
                ].
2aa626e8e404 Fix do not execute an exception handler inside the do-block, when the
Stefan Vogel <sv@exept.de>
parents: 8254
diff changeset
  2031
            ] ifFalse:[
2aa626e8e404 Fix do not execute an exception handler inside the do-block, when the
Stefan Vogel <sv@exept.de>
parents: 8254
diff changeset
  2032
                "skip to the raised exception's handleContext"
2aa626e8e404 Fix do not execute an exception handler inside the do-block, when the
Stefan Vogel <sv@exept.de>
parents: 8254
diff changeset
  2033
                currentContext := con1.
2aa626e8e404 Fix do not execute an exception handler inside the do-block, when the
Stefan Vogel <sv@exept.de>
parents: 8254
diff changeset
  2034
            ].
2aa626e8e404 Fix do not execute an exception handler inside the do-block, when the
Stefan Vogel <sv@exept.de>
parents: 8254
diff changeset
  2035
            ex1 := con1 := nil.
2aa626e8e404 Fix do not execute an exception handler inside the do-block, when the
Stefan Vogel <sv@exept.de>
parents: 8254
diff changeset
  2036
        ] ifFalse:[ "currentContext is a handleContext"
2aa626e8e404 Fix do not execute an exception handler inside the do-block, when the
Stefan Vogel <sv@exept.de>
parents: 8254
diff changeset
  2037
            |r handler|
8617
5fb5a717deff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8509
diff changeset
  2038
8313
2aa626e8e404 Fix do not execute an exception handler inside the do-block, when the
Stefan Vogel <sv@exept.de>
parents: 8254
diff changeset
  2039
            "ask the the receiver of the #handle:do: or #on:do: or whatever- message for the handler.
2aa626e8e404 Fix do not execute an exception handler inside the do-block, when the
Stefan Vogel <sv@exept.de>
parents: 8254
diff changeset
  2040
             nil is returned, if the signal is not accepted"
2aa626e8e404 Fix do not execute an exception handler inside the do-block, when the
Stefan Vogel <sv@exept.de>
parents: 8254
diff changeset
  2041
            r := currentContext receiver.     "receiver of #handle:do: or #on:do:"
8617
5fb5a717deff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8509
diff changeset
  2042
            (r notNil and:[(handler := r handlerForSignal:signal
5fb5a717deff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8509
diff changeset
  2043
                                         context:currentContext
8313
2aa626e8e404 Fix do not execute an exception handler inside the do-block, when the
Stefan Vogel <sv@exept.de>
parents: 8254
diff changeset
  2044
                                         originator:originator) notNil]
2aa626e8e404 Fix do not execute an exception handler inside the do-block, when the
Stefan Vogel <sv@exept.de>
parents: 8254
diff changeset
  2045
            ) ifTrue:[
2aa626e8e404 Fix do not execute an exception handler inside the do-block, when the
Stefan Vogel <sv@exept.de>
parents: 8254
diff changeset
  2046
                "call the handler"
2aa626e8e404 Fix do not execute an exception handler inside the do-block, when the
Stefan Vogel <sv@exept.de>
parents: 8254
diff changeset
  2047
2aa626e8e404 Fix do not execute an exception handler inside the do-block, when the
Stefan Vogel <sv@exept.de>
parents: 8254
diff changeset
  2048
                handlerContext := currentContext.
2aa626e8e404 Fix do not execute an exception handler inside the do-block, when the
Stefan Vogel <sv@exept.de>
parents: 8254
diff changeset
  2049
                currentContext := nil.
2aa626e8e404 Fix do not execute an exception handler inside the do-block, when the
Stefan Vogel <sv@exept.de>
parents: 8254
diff changeset
  2050
                self doCallHandler:handler.
2aa626e8e404 Fix do not execute an exception handler inside the do-block, when the
Stefan Vogel <sv@exept.de>
parents: 8254
diff changeset
  2051
2aa626e8e404 Fix do not execute an exception handler inside the do-block, when the
Stefan Vogel <sv@exept.de>
parents: 8254
diff changeset
  2052
                "if the handler rejects, we arrive here
2aa626e8e404 Fix do not execute an exception handler inside the do-block, when the
Stefan Vogel <sv@exept.de>
parents: 8254
diff changeset
  2053
                 continue search for another handler"
2aa626e8e404 Fix do not execute an exception handler inside the do-block, when the
Stefan Vogel <sv@exept.de>
parents: 8254
diff changeset
  2054
                currentContext := handlerContext.
2aa626e8e404 Fix do not execute an exception handler inside the do-block, when the
Stefan Vogel <sv@exept.de>
parents: 8254
diff changeset
  2055
                handler := handlerContext := nil.
2aa626e8e404 Fix do not execute an exception handler inside the do-block, when the
Stefan Vogel <sv@exept.de>
parents: 8254
diff changeset
  2056
            ].
2aa626e8e404 Fix do not execute an exception handler inside the do-block, when the
Stefan Vogel <sv@exept.de>
parents: 8254
diff changeset
  2057
            r := handler := nil.
2aa626e8e404 Fix do not execute an exception handler inside the do-block, when the
Stefan Vogel <sv@exept.de>
parents: 8254
diff changeset
  2058
        ].
2aa626e8e404 Fix do not execute an exception handler inside the do-block, when the
Stefan Vogel <sv@exept.de>
parents: 8254
diff changeset
  2059
        currentContext notNil ifTrue:[
2aa626e8e404 Fix do not execute an exception handler inside the do-block, when the
Stefan Vogel <sv@exept.de>
parents: 8254
diff changeset
  2060
            currentContext := currentContext findSpecialHandle:true raise:true. "search starts at currentContext sender"
2aa626e8e404 Fix do not execute an exception handler inside the do-block, when the
Stefan Vogel <sv@exept.de>
parents: 8254
diff changeset
  2061
        ].
4481
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2062
    ].
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2063
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2064
    "
8617
5fb5a717deff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8509
diff changeset
  2065
     we arrive here, if either no handler was found,
4481
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2066
     or every handler rejected.
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2067
    "
4484
9476c82921d0 eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents: 4483
diff changeset
  2068
    ^ self doCallAction
4481
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2069
13009
e068f228a24b eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents: 12940
diff changeset
  2070
    "Created: / 12-05-1996 / 15:09:39 / cg"
e068f228a24b eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents: 12940
diff changeset
  2071
    "Modified: / 03-08-1999 / 11:20:41 / stefan"
e068f228a24b eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents: 12940
diff changeset
  2072
    "Modified: / 10-08-2010 / 09:26:14 / cg"
4481
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2073
! !
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2074
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2075
!GenericException methodsFor:'raising'!
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2076
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2077
raise
4484
9476c82921d0 eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents: 4483
diff changeset
  2078
    "actually raise a non-proceedable exception"
4481
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2079
4556
b654bb087103 new proceed code.
Claus Gittinger <cg@exept.de>
parents: 4554
diff changeset
  2080
    <context: #return>
b654bb087103 new proceed code.
Claus Gittinger <cg@exept.de>
parents: 4554
diff changeset
  2081
9992
0774694cf9b3 - Add raiseContext as instance variable for faster #resume
Stefan Vogel <sv@exept.de>
parents: 9505
diff changeset
  2082
    raiseContext := thisContext.
4481
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2083
    suspendedContext isNil ifTrue:[
9992
0774694cf9b3 - Add raiseContext as instance variable for faster #resume
Stefan Vogel <sv@exept.de>
parents: 9505
diff changeset
  2084
        suspendedContext := raiseContext sender
4481
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2085
    ].
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2086
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2087
    proceedable := false.
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2088
    ^ self doRaise
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2089
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2090
    "Modified: / 12.5.1996 / 15:09:47 / cg"
4507
c15d849b1ddc Remove unused vars.
Stefan Vogel <sv@exept.de>
parents: 4504
diff changeset
  2091
    "Modified: / 3.8.1999 / 13:33:01 / stefan"
4481
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2092
!
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2093
13009
e068f228a24b eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents: 12940
diff changeset
  2094
raiseErrorString:aString in:aContext
e068f228a24b eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents: 12940
diff changeset
  2095
    "raise the signal nonproceedable.
e068f228a24b eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents: 12940
diff changeset
  2096
     The argument, aString is used as messageText"
e068f228a24b eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents: 12940
diff changeset
  2097
e068f228a24b eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents: 12940
diff changeset
  2098
    <context: #return>
e068f228a24b eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents: 12940
diff changeset
  2099
e068f228a24b eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents: 12940
diff changeset
  2100
    raiseContext := thisContext.
e068f228a24b eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents: 12940
diff changeset
  2101
    suspendedContext := aContext.
e068f228a24b eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents: 12940
diff changeset
  2102
    messageText := aString.
e068f228a24b eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents: 12940
diff changeset
  2103
    proceedable := false.
e068f228a24b eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents: 12940
diff changeset
  2104
e068f228a24b eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents: 12940
diff changeset
  2105
    ^ self doRaise
e068f228a24b eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents: 12940
diff changeset
  2106
e068f228a24b eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents: 12940
diff changeset
  2107
    "Created: / 10-08-2010 / 09:33:43 / cg"
e068f228a24b eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents: 12940
diff changeset
  2108
!
e068f228a24b eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents: 12940
diff changeset
  2109
e068f228a24b eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents: 12940
diff changeset
  2110
raiseIn:aContext
e068f228a24b eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents: 12940
diff changeset
  2111
    "actually raise a non-proceedable exception"
e068f228a24b eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents: 12940
diff changeset
  2112
e068f228a24b eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents: 12940
diff changeset
  2113
    <context: #return>
e068f228a24b eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents: 12940
diff changeset
  2114
e068f228a24b eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents: 12940
diff changeset
  2115
    raiseContext := thisContext.
e068f228a24b eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents: 12940
diff changeset
  2116
    suspendedContext := aContext.
e068f228a24b eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents: 12940
diff changeset
  2117
    proceedable := false.
e068f228a24b eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents: 12940
diff changeset
  2118
e068f228a24b eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents: 12940
diff changeset
  2119
    ^ self doRaise
e068f228a24b eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents: 12940
diff changeset
  2120
e068f228a24b eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents: 12940
diff changeset
  2121
    "Modified: / 03-08-1999 / 13:33:01 / stefan"
e068f228a24b eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents: 12940
diff changeset
  2122
    "Created: / 10-08-2010 / 09:30:19 / cg"
e068f228a24b eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents: 12940
diff changeset
  2123
!
e068f228a24b eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents: 12940
diff changeset
  2124
4481
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2125
raiseRequest
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2126
    "actually raise a proceedable exception."
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2127
4556
b654bb087103 new proceed code.
Claus Gittinger <cg@exept.de>
parents: 4554
diff changeset
  2128
    <context: #return>
b654bb087103 new proceed code.
Claus Gittinger <cg@exept.de>
parents: 4554
diff changeset
  2129
9992
0774694cf9b3 - Add raiseContext as instance variable for faster #resume
Stefan Vogel <sv@exept.de>
parents: 9505
diff changeset
  2130
    raiseContext := thisContext.
4481
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2131
    suspendedContext isNil ifTrue:[
9992
0774694cf9b3 - Add raiseContext as instance variable for faster #resume
Stefan Vogel <sv@exept.de>
parents: 9505
diff changeset
  2132
        suspendedContext := raiseContext sender
4481
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2133
    ].
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2134
13009
e068f228a24b eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents: 12940
diff changeset
  2135
    self checkProceedable.
4484
9476c82921d0 eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents: 4483
diff changeset
  2136
4481
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2137
    proceedable := true.
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2138
    ^ self doRaise
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2139
10737
de05d84da87d error message (wrong proceedability)
Claus Gittinger <cg@exept.de>
parents: 10389
diff changeset
  2140
    "Modified: / 04-08-1999 / 08:05:12 / stefan"
13009
e068f228a24b eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents: 12940
diff changeset
  2141
    "Modified: / 10-08-2010 / 09:55:00 / cg"
e068f228a24b eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents: 12940
diff changeset
  2142
!
e068f228a24b eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents: 12940
diff changeset
  2143
e068f228a24b eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents: 12940
diff changeset
  2144
raiseRequestErrorString:errorString in:aContext
e068f228a24b eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents: 12940
diff changeset
  2145
    "actually raise a proceedable exception."
e068f228a24b eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents: 12940
diff changeset
  2146
e068f228a24b eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents: 12940
diff changeset
  2147
    <context: #return>
e068f228a24b eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents: 12940
diff changeset
  2148
e068f228a24b eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents: 12940
diff changeset
  2149
    raiseContext := thisContext.
e068f228a24b eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents: 12940
diff changeset
  2150
    suspendedContext := aContext.
e068f228a24b eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents: 12940
diff changeset
  2151
    messageText := errorString.
e068f228a24b eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents: 12940
diff changeset
  2152
e068f228a24b eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents: 12940
diff changeset
  2153
    self checkProceedable.
e068f228a24b eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents: 12940
diff changeset
  2154
e068f228a24b eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents: 12940
diff changeset
  2155
    proceedable := true.
e068f228a24b eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents: 12940
diff changeset
  2156
    ^ self doRaise
e068f228a24b eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents: 12940
diff changeset
  2157
e068f228a24b eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents: 12940
diff changeset
  2158
    "Modified: / 04-08-1999 / 08:05:12 / stefan"
e068f228a24b eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents: 12940
diff changeset
  2159
    "Created: / 10-08-2010 / 09:40:05 / cg"
e068f228a24b eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents: 12940
diff changeset
  2160
!
e068f228a24b eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents: 12940
diff changeset
  2161
e068f228a24b eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents: 12940
diff changeset
  2162
raiseRequestIn:aContext
e068f228a24b eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents: 12940
diff changeset
  2163
    "actually raise a proceedable exception."
e068f228a24b eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents: 12940
diff changeset
  2164
e068f228a24b eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents: 12940
diff changeset
  2165
    <context: #return>
e068f228a24b eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents: 12940
diff changeset
  2166
e068f228a24b eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents: 12940
diff changeset
  2167
    raiseContext := thisContext.
e068f228a24b eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents: 12940
diff changeset
  2168
    suspendedContext := aContext.
e068f228a24b eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents: 12940
diff changeset
  2169
e068f228a24b eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents: 12940
diff changeset
  2170
    self checkProceedable.
e068f228a24b eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents: 12940
diff changeset
  2171
e068f228a24b eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents: 12940
diff changeset
  2172
    proceedable := true.
e068f228a24b eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents: 12940
diff changeset
  2173
    ^ self doRaise
e068f228a24b eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents: 12940
diff changeset
  2174
e068f228a24b eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents: 12940
diff changeset
  2175
    "Modified: / 04-08-1999 / 08:05:12 / stefan"
e068f228a24b eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents: 12940
diff changeset
  2176
    "Created: / 10-08-2010 / 09:36:45 / cg"
5680
7c27d1de0c56 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5590
diff changeset
  2177
!
7c27d1de0c56 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5590
diff changeset
  2178
8774
2bb732840713 +raiseWith / raiseRequestWith
Claus Gittinger <cg@exept.de>
parents: 8733
diff changeset
  2179
raiseRequestWith:aParameter errorString:aString
2bb732840713 +raiseWith / raiseRequestWith
Claus Gittinger <cg@exept.de>
parents: 8733
diff changeset
  2180
    "raise the signal proceedable.
2bb732840713 +raiseWith / raiseRequestWith
Claus Gittinger <cg@exept.de>
parents: 8733
diff changeset
  2181
     The argument, aString is used as messageText,
2bb732840713 +raiseWith / raiseRequestWith
Claus Gittinger <cg@exept.de>
parents: 8733
diff changeset
  2182
     aParameter is passed as exception parameter."
2bb732840713 +raiseWith / raiseRequestWith
Claus Gittinger <cg@exept.de>
parents: 8733
diff changeset
  2183
2bb732840713 +raiseWith / raiseRequestWith
Claus Gittinger <cg@exept.de>
parents: 8733
diff changeset
  2184
    <context: #return>
2bb732840713 +raiseWith / raiseRequestWith
Claus Gittinger <cg@exept.de>
parents: 8733
diff changeset
  2185
2bb732840713 +raiseWith / raiseRequestWith
Claus Gittinger <cg@exept.de>
parents: 8733
diff changeset
  2186
    ^ (self 
2bb732840713 +raiseWith / raiseRequestWith
Claus Gittinger <cg@exept.de>
parents: 8733
diff changeset
  2187
        suspendedContext:thisContext sender parameter:aParameter errorString:aString)
2bb732840713 +raiseWith / raiseRequestWith
Claus Gittinger <cg@exept.de>
parents: 8733
diff changeset
  2188
        raiseRequest.
2bb732840713 +raiseWith / raiseRequestWith
Claus Gittinger <cg@exept.de>
parents: 8733
diff changeset
  2189
    "Created: / 23.7.1999 / 14:08:57 / stefan"
2bb732840713 +raiseWith / raiseRequestWith
Claus Gittinger <cg@exept.de>
parents: 8733
diff changeset
  2190
!
2bb732840713 +raiseWith / raiseRequestWith
Claus Gittinger <cg@exept.de>
parents: 8733
diff changeset
  2191
13009
e068f228a24b eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents: 12940
diff changeset
  2192
raiseRequestWith:aParameter errorString:aString in:aContext
e068f228a24b eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents: 12940
diff changeset
  2193
    "actually raise a proceedable exception."
e068f228a24b eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents: 12940
diff changeset
  2194
e068f228a24b eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents: 12940
diff changeset
  2195
    <context: #return>
e068f228a24b eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents: 12940
diff changeset
  2196
e068f228a24b eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents: 12940
diff changeset
  2197
    raiseContext := thisContext.
e068f228a24b eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents: 12940
diff changeset
  2198
    suspendedContext := aContext.
e068f228a24b eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents: 12940
diff changeset
  2199
    parameter := aParameter.
e068f228a24b eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents: 12940
diff changeset
  2200
    messageText := aString.
e068f228a24b eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents: 12940
diff changeset
  2201
e068f228a24b eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents: 12940
diff changeset
  2202
    self checkProceedable.
e068f228a24b eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents: 12940
diff changeset
  2203
e068f228a24b eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents: 12940
diff changeset
  2204
    proceedable := true.
e068f228a24b eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents: 12940
diff changeset
  2205
    ^ self doRaise
e068f228a24b eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents: 12940
diff changeset
  2206
e068f228a24b eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents: 12940
diff changeset
  2207
    "Modified: / 04-08-1999 / 08:05:12 / stefan"
e068f228a24b eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents: 12940
diff changeset
  2208
    "Created: / 10-08-2010 / 09:55:48 / cg"
e068f228a24b eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents: 12940
diff changeset
  2209
!
e068f228a24b eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents: 12940
diff changeset
  2210
e068f228a24b eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents: 12940
diff changeset
  2211
raiseRequestWith:aParameter in:aContext
e068f228a24b eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents: 12940
diff changeset
  2212
    "actually raise a proceedable exception."
e068f228a24b eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents: 12940
diff changeset
  2213
e068f228a24b eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents: 12940
diff changeset
  2214
    <context: #return>
e068f228a24b eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents: 12940
diff changeset
  2215
e068f228a24b eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents: 12940
diff changeset
  2216
    raiseContext := thisContext.
e068f228a24b eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents: 12940
diff changeset
  2217
    suspendedContext := aContext.
e068f228a24b eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents: 12940
diff changeset
  2218
    parameter := aParameter.
e068f228a24b eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents: 12940
diff changeset
  2219
e068f228a24b eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents: 12940
diff changeset
  2220
    self checkProceedable.
e068f228a24b eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents: 12940
diff changeset
  2221
e068f228a24b eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents: 12940
diff changeset
  2222
    proceedable := true.
e068f228a24b eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents: 12940
diff changeset
  2223
    ^ self doRaise
e068f228a24b eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents: 12940
diff changeset
  2224
e068f228a24b eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents: 12940
diff changeset
  2225
    "Modified: / 04-08-1999 / 08:05:12 / stefan"
e068f228a24b eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents: 12940
diff changeset
  2226
    "Created: / 10-08-2010 / 09:53:51 / cg"
e068f228a24b eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents: 12940
diff changeset
  2227
!
e068f228a24b eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents: 12940
diff changeset
  2228
5680
7c27d1de0c56 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5590
diff changeset
  2229
raiseSignal
7c27d1de0c56 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5590
diff changeset
  2230
    "actually raise an exception (whatever the proceedability is)."
7c27d1de0c56 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5590
diff changeset
  2231
6430
9a1580465dd2 better impl. of #deferAfter:
Claus Gittinger <cg@exept.de>
parents: 6426
diff changeset
  2232
    <context: #return>
15954
79784e354f4d merged in jv's changes
Claus Gittinger <cg@exept.de>
parents: 15692
diff changeset
  2233
    <resource: #skipInDebuggersWalkBack>
79784e354f4d merged in jv's changes
Claus Gittinger <cg@exept.de>
parents: 15692
diff changeset
  2234
6430
9a1580465dd2 better impl. of #deferAfter:
Claus Gittinger <cg@exept.de>
parents: 6426
diff changeset
  2235
9992
0774694cf9b3 - Add raiseContext as instance variable for faster #resume
Stefan Vogel <sv@exept.de>
parents: 9505
diff changeset
  2236
    raiseContext := thisContext.
8684
9c00854305f7 QuerySignal generates Notifications instead of Exceptions.
Stefan Vogel <sv@exept.de>
parents: 8681
diff changeset
  2237
    suspendedContext isNil ifTrue:[
9992
0774694cf9b3 - Add raiseContext as instance variable for faster #resume
Stefan Vogel <sv@exept.de>
parents: 9505
diff changeset
  2238
        suspendedContext := raiseContext sender
5680
7c27d1de0c56 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5590
diff changeset
  2239
    ].
8684
9c00854305f7 QuerySignal generates Notifications instead of Exceptions.
Stefan Vogel <sv@exept.de>
parents: 8681
diff changeset
  2240
    proceedable := self mayProceed.
9c00854305f7 QuerySignal generates Notifications instead of Exceptions.
Stefan Vogel <sv@exept.de>
parents: 8681
diff changeset
  2241
    ^ self doRaise
15954
79784e354f4d merged in jv's changes
Claus Gittinger <cg@exept.de>
parents: 15692
diff changeset
  2242
79784e354f4d merged in jv's changes
Claus Gittinger <cg@exept.de>
parents: 15692
diff changeset
  2243
    "Modified: / 19-04-2013 / 09:37:50 / Jan Vrany <jan.vrany@fit.cvut.cz>"
8774
2bb732840713 +raiseWith / raiseRequestWith
Claus Gittinger <cg@exept.de>
parents: 8733
diff changeset
  2244
!
2bb732840713 +raiseWith / raiseRequestWith
Claus Gittinger <cg@exept.de>
parents: 8733
diff changeset
  2245
2bb732840713 +raiseWith / raiseRequestWith
Claus Gittinger <cg@exept.de>
parents: 8733
diff changeset
  2246
raiseWith:aParameter errorString:aString
2bb732840713 +raiseWith / raiseRequestWith
Claus Gittinger <cg@exept.de>
parents: 8733
diff changeset
  2247
    "raise the signal nonproceedable.
2bb732840713 +raiseWith / raiseRequestWith
Claus Gittinger <cg@exept.de>
parents: 8733
diff changeset
  2248
     The argument, aString is used as messageText,
2bb732840713 +raiseWith / raiseRequestWith
Claus Gittinger <cg@exept.de>
parents: 8733
diff changeset
  2249
     aParameter is passed as exception parameter."
2bb732840713 +raiseWith / raiseRequestWith
Claus Gittinger <cg@exept.de>
parents: 8733
diff changeset
  2250
2bb732840713 +raiseWith / raiseRequestWith
Claus Gittinger <cg@exept.de>
parents: 8733
diff changeset
  2251
    <context: #return>
2bb732840713 +raiseWith / raiseRequestWith
Claus Gittinger <cg@exept.de>
parents: 8733
diff changeset
  2252
2bb732840713 +raiseWith / raiseRequestWith
Claus Gittinger <cg@exept.de>
parents: 8733
diff changeset
  2253
    ^ (self 
2bb732840713 +raiseWith / raiseRequestWith
Claus Gittinger <cg@exept.de>
parents: 8733
diff changeset
  2254
        suspendedContext:thisContext sender parameter:aParameter errorString:aString)
2bb732840713 +raiseWith / raiseRequestWith
Claus Gittinger <cg@exept.de>
parents: 8733
diff changeset
  2255
        raise.
13009
e068f228a24b eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents: 12940
diff changeset
  2256
!
e068f228a24b eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents: 12940
diff changeset
  2257
e068f228a24b eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents: 12940
diff changeset
  2258
raiseWith:aParameter errorString:aString in:aContext
e068f228a24b eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents: 12940
diff changeset
  2259
    "raise the signal nonproceedable.
e068f228a24b eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents: 12940
diff changeset
  2260
     The argument, aString is used as messageText"
e068f228a24b eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents: 12940
diff changeset
  2261
e068f228a24b eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents: 12940
diff changeset
  2262
    <context: #return>
e068f228a24b eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents: 12940
diff changeset
  2263
e068f228a24b eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents: 12940
diff changeset
  2264
    raiseContext := thisContext.
e068f228a24b eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents: 12940
diff changeset
  2265
    suspendedContext := aContext.
e068f228a24b eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents: 12940
diff changeset
  2266
    messageText := aString.
e068f228a24b eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents: 12940
diff changeset
  2267
    parameter := aParameter.
e068f228a24b eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents: 12940
diff changeset
  2268
    proceedable := false.
e068f228a24b eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents: 12940
diff changeset
  2269
e068f228a24b eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents: 12940
diff changeset
  2270
    ^ self doRaise
e068f228a24b eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents: 12940
diff changeset
  2271
e068f228a24b eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents: 12940
diff changeset
  2272
    "Created: / 10-08-2010 / 09:51:51 / cg"
e068f228a24b eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents: 12940
diff changeset
  2273
!
e068f228a24b eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents: 12940
diff changeset
  2274
e068f228a24b eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents: 12940
diff changeset
  2275
raiseWith:aParameter in:aContext
e068f228a24b eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents: 12940
diff changeset
  2276
    "raise the signal nonproceedable.
e068f228a24b eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents: 12940
diff changeset
  2277
     The argument, aString is used as messageText"
e068f228a24b eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents: 12940
diff changeset
  2278
e068f228a24b eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents: 12940
diff changeset
  2279
    <context: #return>
e068f228a24b eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents: 12940
diff changeset
  2280
e068f228a24b eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents: 12940
diff changeset
  2281
    raiseContext := thisContext.
e068f228a24b eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents: 12940
diff changeset
  2282
    suspendedContext := aContext.
e068f228a24b eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents: 12940
diff changeset
  2283
    parameter := aParameter.
e068f228a24b eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents: 12940
diff changeset
  2284
    proceedable := false.
e068f228a24b eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents: 12940
diff changeset
  2285
e068f228a24b eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents: 12940
diff changeset
  2286
    ^ self doRaise
e068f228a24b eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents: 12940
diff changeset
  2287
e068f228a24b eliminated 1 to 2 message sends when raising
Claus Gittinger <cg@exept.de>
parents: 12940
diff changeset
  2288
    "Created: / 10-08-2010 / 09:50:54 / cg"
16190
05ae6b8316b7 class: GenericException
Claus Gittinger <cg@exept.de>
parents: 16157
diff changeset
  2289
!
05ae6b8316b7 class: GenericException
Claus Gittinger <cg@exept.de>
parents: 16157
diff changeset
  2290
05ae6b8316b7 class: GenericException
Claus Gittinger <cg@exept.de>
parents: 16157
diff changeset
  2291
signal
05ae6b8316b7 class: GenericException
Claus Gittinger <cg@exept.de>
parents: 16157
diff changeset
  2292
    "return the signal, that caused the exception.
05ae6b8316b7 class: GenericException
Claus Gittinger <cg@exept.de>
parents: 16157
diff changeset
  2293
     Warning and notice: in ANSI, signal means: raise;
05ae6b8316b7 class: GenericException
Claus Gittinger <cg@exept.de>
parents: 16157
diff changeset
  2294
     here and in old VW, it is the accessor to the creator signal/exception.
05ae6b8316b7 class: GenericException
Claus Gittinger <cg@exept.de>
parents: 16157
diff changeset
  2295
05ae6b8316b7 class: GenericException
Claus Gittinger <cg@exept.de>
parents: 16157
diff changeset
  2296
     This has now changed to be compatible with ANSI/Squeak.
05ae6b8316b7 class: GenericException
Claus Gittinger <cg@exept.de>
parents: 16157
diff changeset
  2297
     Please use #creator to get the creator."
05ae6b8316b7 class: GenericException
Claus Gittinger <cg@exept.de>
parents: 16157
diff changeset
  2298
05ae6b8316b7 class: GenericException
Claus Gittinger <cg@exept.de>
parents: 16157
diff changeset
  2299
    self raiseSignal.
5697
ce78c7d9ddbd raiseSignal / raiseSignal: / raiseSignal:with:
Claus Gittinger <cg@exept.de>
parents: 5684
diff changeset
  2300
! !
4481
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2301
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2302
!GenericException methodsFor:'setup'!
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2303
15237
661c2ad1edb8 class: GenericException
Stefan Vogel <sv@exept.de>
parents: 15123
diff changeset
  2304
creator:aSignal
6945
9536335d243b use setSignal, to avoid conflict with dolphin signals
Claus Gittinger <cg@exept.de>
parents: 6920
diff changeset
  2305
    "set the fields usable for inspection by the handler
15237
661c2ad1edb8 class: GenericException
Stefan Vogel <sv@exept.de>
parents: 15123
diff changeset
  2306
     - only to be sent from the signal when raising."
6945
9536335d243b use setSignal, to avoid conflict with dolphin signals
Claus Gittinger <cg@exept.de>
parents: 6920
diff changeset
  2307
9536335d243b use setSignal, to avoid conflict with dolphin signals
Claus Gittinger <cg@exept.de>
parents: 6920
diff changeset
  2308
    signal := aSignal.
9536335d243b use setSignal, to avoid conflict with dolphin signals
Claus Gittinger <cg@exept.de>
parents: 6920
diff changeset
  2309
!
9536335d243b use setSignal, to avoid conflict with dolphin signals
Claus Gittinger <cg@exept.de>
parents: 6920
diff changeset
  2310
6430
9a1580465dd2 better impl. of #deferAfter:
Claus Gittinger <cg@exept.de>
parents: 6426
diff changeset
  2311
suspendedContext:sContext errorString:aString
8617
5fb5a717deff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8509
diff changeset
  2312
    "set required fields
6430
9a1580465dd2 better impl. of #deferAfter:
Claus Gittinger <cg@exept.de>
parents: 6426
diff changeset
  2313
     - only to be sent from the signal when raising"
9a1580465dd2 better impl. of #deferAfter:
Claus Gittinger <cg@exept.de>
parents: 6426
diff changeset
  2314
8313
2aa626e8e404 Fix do not execute an exception handler inside the do-block, when the
Stefan Vogel <sv@exept.de>
parents: 8254
diff changeset
  2315
    messageText := aString.
6430
9a1580465dd2 better impl. of #deferAfter:
Claus Gittinger <cg@exept.de>
parents: 6426
diff changeset
  2316
    suspendedContext := sContext.
9a1580465dd2 better impl. of #deferAfter:
Claus Gittinger <cg@exept.de>
parents: 6426
diff changeset
  2317
!
9a1580465dd2 better impl. of #deferAfter:
Claus Gittinger <cg@exept.de>
parents: 6426
diff changeset
  2318
8684
9c00854305f7 QuerySignal generates Notifications instead of Exceptions.
Stefan Vogel <sv@exept.de>
parents: 8681
diff changeset
  2319
suspendedContext:aContext messageText:aString parameter:aParameter originator:anOriginator
9c00854305f7 QuerySignal generates Notifications instead of Exceptions.
Stefan Vogel <sv@exept.de>
parents: 8681
diff changeset
  2320
    suspendedContext := aContext.
9c00854305f7 QuerySignal generates Notifications instead of Exceptions.
Stefan Vogel <sv@exept.de>
parents: 8681
diff changeset
  2321
    messageText := aString.
9c00854305f7 QuerySignal generates Notifications instead of Exceptions.
Stefan Vogel <sv@exept.de>
parents: 8681
diff changeset
  2322
    parameter := aParameter.
9c00854305f7 QuerySignal generates Notifications instead of Exceptions.
Stefan Vogel <sv@exept.de>
parents: 8681
diff changeset
  2323
    originator := anOriginator.
9c00854305f7 QuerySignal generates Notifications instead of Exceptions.
Stefan Vogel <sv@exept.de>
parents: 8681
diff changeset
  2324
!
9c00854305f7 QuerySignal generates Notifications instead of Exceptions.
Stefan Vogel <sv@exept.de>
parents: 8681
diff changeset
  2325
6430
9a1580465dd2 better impl. of #deferAfter:
Claus Gittinger <cg@exept.de>
parents: 6426
diff changeset
  2326
suspendedContext:sContext parameter:aParameter
8617
5fb5a717deff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8509
diff changeset
  2327
    "set required fields
6430
9a1580465dd2 better impl. of #deferAfter:
Claus Gittinger <cg@exept.de>
parents: 6426
diff changeset
  2328
     - only to be sent from the signal when raising"
9a1580465dd2 better impl. of #deferAfter:
Claus Gittinger <cg@exept.de>
parents: 6426
diff changeset
  2329
9a1580465dd2 better impl. of #deferAfter:
Claus Gittinger <cg@exept.de>
parents: 6426
diff changeset
  2330
    parameter := aParameter.
9a1580465dd2 better impl. of #deferAfter:
Claus Gittinger <cg@exept.de>
parents: 6426
diff changeset
  2331
    suspendedContext := sContext.
9a1580465dd2 better impl. of #deferAfter:
Claus Gittinger <cg@exept.de>
parents: 6426
diff changeset
  2332
!
9a1580465dd2 better impl. of #deferAfter:
Claus Gittinger <cg@exept.de>
parents: 6426
diff changeset
  2333
9a1580465dd2 better impl. of #deferAfter:
Claus Gittinger <cg@exept.de>
parents: 6426
diff changeset
  2334
suspendedContext:sContext parameter:aParameter errorString:aString
8617
5fb5a717deff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8509
diff changeset
  2335
    "set required fields
6430
9a1580465dd2 better impl. of #deferAfter:
Claus Gittinger <cg@exept.de>
parents: 6426
diff changeset
  2336
     - only to be sent from the signal when raising"
9a1580465dd2 better impl. of #deferAfter:
Claus Gittinger <cg@exept.de>
parents: 6426
diff changeset
  2337
9a1580465dd2 better impl. of #deferAfter:
Claus Gittinger <cg@exept.de>
parents: 6426
diff changeset
  2338
    parameter := aParameter.
8313
2aa626e8e404 Fix do not execute an exception handler inside the do-block, when the
Stefan Vogel <sv@exept.de>
parents: 8254
diff changeset
  2339
    messageText := aString.
6430
9a1580465dd2 better impl. of #deferAfter:
Claus Gittinger <cg@exept.de>
parents: 6426
diff changeset
  2340
    suspendedContext := sContext.
8684
9c00854305f7 QuerySignal generates Notifications instead of Exceptions.
Stefan Vogel <sv@exept.de>
parents: 8681
diff changeset
  2341
!
9c00854305f7 QuerySignal generates Notifications instead of Exceptions.
Stefan Vogel <sv@exept.de>
parents: 8681
diff changeset
  2342
9c00854305f7 QuerySignal generates Notifications instead of Exceptions.
Stefan Vogel <sv@exept.de>
parents: 8681
diff changeset
  2343
suspendedContext:aContext parameter:aParameter originator:anOriginator
9c00854305f7 QuerySignal generates Notifications instead of Exceptions.
Stefan Vogel <sv@exept.de>
parents: 8681
diff changeset
  2344
    suspendedContext := aContext.
9c00854305f7 QuerySignal generates Notifications instead of Exceptions.
Stefan Vogel <sv@exept.de>
parents: 8681
diff changeset
  2345
    parameter := aParameter.
9c00854305f7 QuerySignal generates Notifications instead of Exceptions.
Stefan Vogel <sv@exept.de>
parents: 8681
diff changeset
  2346
    originator := anOriginator.
4481
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2347
! !
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2348
6220
1b9aa02b02ef isException query
Claus Gittinger <cg@exept.de>
parents: 6200
diff changeset
  2349
!GenericException methodsFor:'testing'!
1b9aa02b02ef isException query
Claus Gittinger <cg@exept.de>
parents: 6200
diff changeset
  2350
8065
23355398af34 isOpenError, isStreamError and isError queries added
Claus Gittinger <cg@exept.de>
parents: 7808
diff changeset
  2351
isError
23355398af34 isOpenError, isStreamError and isError queries added
Claus Gittinger <cg@exept.de>
parents: 7808
diff changeset
  2352
    ^ false
23355398af34 isOpenError, isStreamError and isError queries added
Claus Gittinger <cg@exept.de>
parents: 7808
diff changeset
  2353
!
23355398af34 isOpenError, isStreamError and isError queries added
Claus Gittinger <cg@exept.de>
parents: 7808
diff changeset
  2354
6220
1b9aa02b02ef isException query
Claus Gittinger <cg@exept.de>
parents: 6200
diff changeset
  2355
isException
1b9aa02b02ef isException query
Claus Gittinger <cg@exept.de>
parents: 6200
diff changeset
  2356
    ^ true
1b9aa02b02ef isException query
Claus Gittinger <cg@exept.de>
parents: 6200
diff changeset
  2357
1b9aa02b02ef isException query
Claus Gittinger <cg@exept.de>
parents: 6200
diff changeset
  2358
    "Created: / 17.11.2001 / 18:37:27 / cg"
8681
38aa963476a5 Support for Block>>#on:do:on:do:
Stefan Vogel <sv@exept.de>
parents: 8677
diff changeset
  2359
!
38aa963476a5 Support for Block>>#on:do:on:do:
Stefan Vogel <sv@exept.de>
parents: 8677
diff changeset
  2360
38aa963476a5 Support for Block>>#on:do:on:do:
Stefan Vogel <sv@exept.de>
parents: 8677
diff changeset
  2361
isNotification
38aa963476a5 Support for Block>>#on:do:on:do:
Stefan Vogel <sv@exept.de>
parents: 8677
diff changeset
  2362
    ^ false
6220
1b9aa02b02ef isException query
Claus Gittinger <cg@exept.de>
parents: 6200
diff changeset
  2363
! !
1b9aa02b02ef isException query
Claus Gittinger <cg@exept.de>
parents: 6200
diff changeset
  2364
4481
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2365
!GenericException class methodsFor:'documentation'!
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2366
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2367
version
16248
933761e57891 class: GenericException
Stefan Vogel <sv@exept.de>
parents: 16224
diff changeset
  2368
    ^ '$Header: /cvs/stx/stx/libbasic/GenericException.st,v 1.153 2014-03-11 09:27:34 stefan Exp $'
12059
dc79a13a160a added: #evaluate:ifRaised:
Claus Gittinger <cg@exept.de>
parents: 11775
diff changeset
  2369
!
dc79a13a160a added: #evaluate:ifRaised:
Claus Gittinger <cg@exept.de>
parents: 11775
diff changeset
  2370
dc79a13a160a added: #evaluate:ifRaised:
Claus Gittinger <cg@exept.de>
parents: 11775
diff changeset
  2371
version_CVS
16248
933761e57891 class: GenericException
Stefan Vogel <sv@exept.de>
parents: 16224
diff changeset
  2372
    ^ '$Header: /cvs/stx/stx/libbasic/GenericException.st,v 1.153 2014-03-11 09:27:34 stefan Exp $'
4481
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2373
! !
6859
5ef85865e8db Print exception description with #printOn:
Stefan Vogel <sv@exept.de>
parents: 6630
diff changeset
  2374
14962
2d0932f775a2 class: GenericException
Claus Gittinger <cg@exept.de>
parents: 14241
diff changeset
  2375
4481
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2376
GenericException initialize!