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