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