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