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