GenericException.st
author Stefan Vogel <sv@exept.de>
Wed, 04 Aug 1999 08:57:13 +0200
changeset 4517 8c539600fb63
parent 4513 b16770982c62
child 4519 fb4904d6787b
permissions -rw-r--r--
Implement NoHandlerException etc. as class based exceptions.
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
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     3
	      All Rights Reserved
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
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    13
Object subclass:#GenericException
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    14
	instanceVariableNames:'signal parameter errorString suspendedContext handlerContext
4504
173da3e8b629 checkin from browser
Stefan Vogel <sv@exept.de>
parents: 4498
diff changeset
    15
		rejected originator proceedable handlingException'
4481
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    16
	classVariableNames:'EmergencyHandler RecursiveExceptionSignal'
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    17
	poolDictionaries:''
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    18
	category:'Kernel-Exceptions'
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    19
!
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    20
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    21
GenericException class instanceVariableNames:'NotifierString'
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    22
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    23
"
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    24
 The following class instance variables are inherited by this class:
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    25
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    26
	Object - 
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
4517
8c539600fb63 Implement NoHandlerException etc. as class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4513
diff changeset
    30
Error subclass:#WrongProceedabilityError
8c539600fb63 Implement NoHandlerException etc. as class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4513
diff changeset
    31
	instanceVariableNames:''
8c539600fb63 Implement NoHandlerException etc. as class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4513
diff changeset
    32
	classVariableNames:''
8c539600fb63 Implement NoHandlerException etc. as class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4513
diff changeset
    33
	poolDictionaries:''
8c539600fb63 Implement NoHandlerException etc. as class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4513
diff changeset
    34
	privateIn:GenericException
8c539600fb63 Implement NoHandlerException etc. as class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4513
diff changeset
    35
!
8c539600fb63 Implement NoHandlerException etc. as class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4513
diff changeset
    36
8c539600fb63 Implement NoHandlerException etc. as class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4513
diff changeset
    37
Error subclass:#NoHandlerError
8c539600fb63 Implement NoHandlerException etc. as class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4513
diff changeset
    38
	instanceVariableNames:''
8c539600fb63 Implement NoHandlerException etc. as class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4513
diff changeset
    39
	classVariableNames:''
8c539600fb63 Implement NoHandlerException etc. as class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4513
diff changeset
    40
	poolDictionaries:''
8c539600fb63 Implement NoHandlerException etc. as class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4513
diff changeset
    41
	privateIn:GenericException
8c539600fb63 Implement NoHandlerException etc. as class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4513
diff changeset
    42
!
8c539600fb63 Implement NoHandlerException etc. as class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4513
diff changeset
    43
8c539600fb63 Implement NoHandlerException etc. as class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4513
diff changeset
    44
Warning subclass:#ProceedError
8c539600fb63 Implement NoHandlerException etc. as class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4513
diff changeset
    45
	instanceVariableNames:''
8c539600fb63 Implement NoHandlerException etc. as class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4513
diff changeset
    46
	classVariableNames:''
8c539600fb63 Implement NoHandlerException etc. as class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4513
diff changeset
    47
	poolDictionaries:''
8c539600fb63 Implement NoHandlerException etc. as class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4513
diff changeset
    48
	privateIn:GenericException
8c539600fb63 Implement NoHandlerException etc. as class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4513
diff changeset
    49
!
8c539600fb63 Implement NoHandlerException etc. as class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4513
diff changeset
    50
4481
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    51
!GenericException class methodsFor:'documentation'!
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    52
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    53
copyright
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    54
"
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    55
 COPYRIGHT (c) 1993 by Claus Gittinger
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    56
	      All Rights Reserved
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    57
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    58
 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
    59
 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
    60
 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
    61
 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
    62
 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
    63
 hereby transferred.
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    64
"
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    65
!
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    66
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    67
documentation
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    68
"
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    69
    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
    70
    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
    71
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    72
    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
    73
    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
    74
    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
    75
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    76
	reject          - don't handle this signal;
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    77
			  another handler will be searched for, 
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    78
			  upper in the calling hierarchy
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    79
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    80
	proceed         - return from the Signal>>raise, with nil as value
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    81
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    82
	proceedWith:val - same, but return val from Signal>>raise
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    83
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    84
	return          - return from the Signal>>handle:do:, with nil as value
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    85
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    86
	returnWith:val  - same, but return val from Signal>>handle:do:
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    87
			  (this is also the handlers default, 
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    88
			   if it falls through; taking the handlerBlocks value
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    89
			   as return value)
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    90
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    91
	restart         - restart the Signal>>handle:do:, after repairing
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
    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
    94
    where the Signal was raised, where the handler is, the signal which caused
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    95
    the error and the errorString passed when the signal was raised. Also, an optional
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    96
    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
    97
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    98
    [instance variables:]
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    99
	signal           <Signal>     the signal which caused the exception
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   100
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   101
	parameter        <Object>     a parameter (if any) which was passed when raising
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   102
				      the signal (only if raised with #raiseWith:aParameter)
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   103
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   104
	errorString      <String>     an errorString 
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   105
				      (usually the signals own errorString, but sometimes
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   106
				       changed explicitely in #raiseWith:errorString:)
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   107
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   108
	suspendedContext <Context>    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
   109
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   110
	handlerContext   <Context>    the context of the handler (if any)
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   111
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   112
    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
   113
    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
   114
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   115
    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
   116
    possible.
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   117
    For example, to get the typical C++ behavior, use:
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   118
	Exception emergencyHandler:[:ex | Smalltalk exitWithCoreDump]
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   119
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   120
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   121
    [Class variables:]
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   122
	EmergencyHandler <Block>    this block is evaluated, if no handler was defined
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   123
				    for a signal (i.e. this one is responsible for the
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   124
				    unhandled exception debugger).
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   125
				    Having this being a block allows to globally catch
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   126
				    these errors - even when no enclosing handler-scope
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   127
				    around the erronous code exists.
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   128
				    (as the catch/through does).
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   129
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   130
	RecursiveExceptionSignal
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   131
			 <Signal>   raised when within a handler for some signal,
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   132
				    the same signal is raised again.
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   133
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   134
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   135
    [see also:]
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   136
	Signal  SignalSet QuerySignal
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   137
	Context Block
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   138
	Object DebugView
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   139
	(``Exception handling and signals'': programming/exceptions.html)
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   140
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   141
    [author:]
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   142
	Claus Gittinger
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   143
"
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   144
!
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   145
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   146
examples
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   147
"
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   148
    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
   149
    section (CodingExamples).
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   150
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   151
    The emergencyHandler stuff is very useful, to prevent endUser applications
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   152
    from entering the debugger.
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   153
    Some commonly used (useful) emergency handlers are provided in the
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   154
    'useful handlers' section; try them to learn more
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   155
    (especially, the mailingHandler is fun).
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   156
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   157
    Of course, these are only examples - you may define your own handler
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   158
    block and pass it to the #emergencyHandler: method.
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   159
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   160
    BTW: the Launchers 'source & debugger' settings menu allows you
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   161
	 to install either a default or the notifying handler.
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   162
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   163
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   164
    A handler which shows a box, then aborts - (no more debuggers):
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   165
								[exBegin]
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   166
	Exception emergencyHandler:(Exception abortingEmergencyHandler)
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   167
								[exEnd]
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   168
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   169
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   170
    A handler which aborts - (no box, no debugger):
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   171
								[exBegin]
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   172
	Exception emergencyHandler:[:ex | AbortSignal raise]
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   173
								[exEnd]
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   174
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   175
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   176
    try some exception (for demonstration, in some other process):
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   177
								[exBegin]
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   178
	[
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   179
	    #(1 2 3) at:4
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   180
	] fork.
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   181
								[exEnd]
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
    cleanup (switch back to the regular handler, which enters the debugger):
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   184
								[exBegin]
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   185
	Exception emergencyHandler:nil
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   186
								[exEnd]
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   187
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
    A handler which shows a warnBox and asks for debugging:
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   190
								[exBegin]
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   191
	Exception emergencyHandler:(Exception notifyingEmergencyHandler)
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   192
								[exEnd]
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   193
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
    A handler which dumps information to a file (watch the file 'errorTrace.stx'):
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   197
								[exBegin]
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   198
	Exception emergencyHandler:(Exception dumpingEmergencyHandler)
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   199
								[exEnd]
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   200
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
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   203
    A handler which sends you mail:
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   204
								[exBegin]
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   205
	Exception emergencyHandler:(Exception mailingEmergencyHandler)
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   206
								[exEnd]
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   207
"
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
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   210
!GenericException class methodsFor:'initialization'!
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   211
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   212
initialize 
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   213
    "setup the signal used to handle unhandled signals"
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   214
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   215
    RecursiveExceptionSignal isNil ifTrue:[
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   216
	RecursiveExceptionSignal := ErrorSignal newSignalMayProceed:false.
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   217
	RecursiveExceptionSignal nameClass:self message:#recursiveExceptionSignal.
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   218
	RecursiveExceptionSignal notifierString:'recursive signal raise in handler'
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   219
    ]
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   220
! !
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   221
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   222
!GenericException class methodsFor:'instance creation'!
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   223
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   224
signal:aSignal originator:origin
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   225
    "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
   226
     - 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
   227
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   228
    "{ Pragma: +inlineNew }"
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   229
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   230
    ^ (self basicNew) signal:aSignal originator:origin.
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   231
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   232
    "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
   233
!
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   234
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   235
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
   236
    "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
   237
     - 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
   238
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   239
    "{ Pragma: +inlineNew }"
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   240
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   241
    ^ (self basicNew)
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   242
	signal:aSignal 
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   243
	parameter:aParameter 
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   244
	errorString:aString 
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   245
	suspendedContext:sContext 
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   246
	originator:origin.
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   247
! !
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   248
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   249
!GenericException class methodsFor:'Signal constants'!
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   250
4517
8c539600fb63 Implement NoHandlerException etc. as class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4513
diff changeset
   251
noHandlerError
8c539600fb63 Implement NoHandlerException etc. as class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4513
diff changeset
   252
8c539600fb63 Implement NoHandlerException etc. as class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4513
diff changeset
   253
    ^ NoHandlerError
8c539600fb63 Implement NoHandlerException etc. as class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4513
diff changeset
   254
8c539600fb63 Implement NoHandlerException etc. as class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4513
diff changeset
   255
    "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
   256
!
8c539600fb63 Implement NoHandlerException etc. as class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4513
diff changeset
   257
8c539600fb63 Implement NoHandlerException etc. as class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4513
diff changeset
   258
proceedError
8c539600fb63 Implement NoHandlerException etc. as class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4513
diff changeset
   259
8c539600fb63 Implement NoHandlerException etc. as class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4513
diff changeset
   260
    ^ ProceedError
8c539600fb63 Implement NoHandlerException etc. as class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4513
diff changeset
   261
8c539600fb63 Implement NoHandlerException etc. as class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4513
diff changeset
   262
    "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
   263
!
8c539600fb63 Implement NoHandlerException etc. as class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4513
diff changeset
   264
4481
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   265
recursiveExceptionSignal
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   266
    "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
   267
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   268
    ^ RecursiveExceptionSignal
4517
8c539600fb63 Implement NoHandlerException etc. as class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4513
diff changeset
   269
!
8c539600fb63 Implement NoHandlerException etc. as class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4513
diff changeset
   270
8c539600fb63 Implement NoHandlerException etc. as class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4513
diff changeset
   271
wrongProceedabilityError
8c539600fb63 Implement NoHandlerException etc. as class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4513
diff changeset
   272
8c539600fb63 Implement NoHandlerException etc. as class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4513
diff changeset
   273
    ^ WrongProceedabilityError
8c539600fb63 Implement NoHandlerException etc. as class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4513
diff changeset
   274
8c539600fb63 Implement NoHandlerException etc. as class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4513
diff changeset
   275
    "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
   276
! !
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   277
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   278
!GenericException class methodsFor:'compatibility - accessing'!
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   279
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   280
errorString
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   281
    "return the notifier string.
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   282
     If the notifier string starts with space, prepend
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   283
     the parents notifier string"
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   284
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   285
    NotifierString isNil ifTrue:[
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   286
	^ self parent errorString
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   287
    ] ifFalse:[
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   288
	(NotifierString size > 0 
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   289
	 and:[NotifierString first == (Character space)]) ifTrue:[
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   290
	    ^ self parent errorString, NotifierString
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   291
	] ifFalse:[
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   292
	    ^ NotifierString
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
    ]
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   295
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   296
    "
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   297
      Object errorSignal errorString
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   298
    "
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   299
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   300
    "Created: / 23.7.1999 / 14:22:25 / stefan"
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
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   303
errorStringExtra:extraString with:aParameter
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   304
    "used when raising with a given error string and/or parameter; 
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   305
     if the errorString starts with a space, it is appended to the receivers
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   306
     notifier string; if it ends with a space, it is prepended.
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   307
     Otherwise, the extraString is returned.
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   308
     If no extraString is given, use the signals default errorString."
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   309
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   310
    |t|
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   311
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   312
    (self inheritsFrom:Object userNotificationSignal) ifTrue:[
4504
173da3e8b629 checkin from browser
Stefan Vogel <sv@exept.de>
parents: 4498
diff changeset
   313
        "/ all userNotifications pass the extraString unchanged.
173da3e8b629 checkin from browser
Stefan Vogel <sv@exept.de>
parents: 4498
diff changeset
   314
        ^ extraString
4481
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   315
    ].
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   316
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   317
    extraString isNil ifTrue:[
4504
173da3e8b629 checkin from browser
Stefan Vogel <sv@exept.de>
parents: 4498
diff changeset
   318
        t := self errorString
4481
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   319
    ] ifFalse:[
4504
173da3e8b629 checkin from browser
Stefan Vogel <sv@exept.de>
parents: 4498
diff changeset
   320
        t := extraString.
173da3e8b629 checkin from browser
Stefan Vogel <sv@exept.de>
parents: 4498
diff changeset
   321
        (extraString endsWith:Character space) ifTrue:[
173da3e8b629 checkin from browser
Stefan Vogel <sv@exept.de>
parents: 4498
diff changeset
   322
            t := extraString, self errorString
173da3e8b629 checkin from browser
Stefan Vogel <sv@exept.de>
parents: 4498
diff changeset
   323
        ] ifFalse:[
173da3e8b629 checkin from browser
Stefan Vogel <sv@exept.de>
parents: 4498
diff changeset
   324
            (extraString startsWith:Character space) ifTrue:[
173da3e8b629 checkin from browser
Stefan Vogel <sv@exept.de>
parents: 4498
diff changeset
   325
                t := self errorString, extraString
173da3e8b629 checkin from browser
Stefan Vogel <sv@exept.de>
parents: 4498
diff changeset
   326
            ]
173da3e8b629 checkin from browser
Stefan Vogel <sv@exept.de>
parents: 4498
diff changeset
   327
        ].
4481
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   328
    ].
4504
173da3e8b629 checkin from browser
Stefan Vogel <sv@exept.de>
parents: 4498
diff changeset
   329
173da3e8b629 checkin from browser
Stefan Vogel <sv@exept.de>
parents: 4498
diff changeset
   330
    aParameter isNil ifTrue:[
173da3e8b629 checkin from browser
Stefan Vogel <sv@exept.de>
parents: 4498
diff changeset
   331
        ^ t.
173da3e8b629 checkin from browser
Stefan Vogel <sv@exept.de>
parents: 4498
diff changeset
   332
    ].
4481
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   333
4504
173da3e8b629 checkin from browser
Stefan Vogel <sv@exept.de>
parents: 4498
diff changeset
   334
    (t startsWith:' ') ifTrue:[
173da3e8b629 checkin from browser
Stefan Vogel <sv@exept.de>
parents: 4498
diff changeset
   335
        ^ aParameter printString , t.
173da3e8b629 checkin from browser
Stefan Vogel <sv@exept.de>
parents: 4498
diff changeset
   336
    ].
173da3e8b629 checkin from browser
Stefan Vogel <sv@exept.de>
parents: 4498
diff changeset
   337
    (t endsWith:' ') ifTrue:[
173da3e8b629 checkin from browser
Stefan Vogel <sv@exept.de>
parents: 4498
diff changeset
   338
        ^ t , aParameter printString.
173da3e8b629 checkin from browser
Stefan Vogel <sv@exept.de>
parents: 4498
diff changeset
   339
    ].
173da3e8b629 checkin from browser
Stefan Vogel <sv@exept.de>
parents: 4498
diff changeset
   340
    ^ t
4481
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   341
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   342
    "Modified: / 25.3.1997 / 12:12:37 / cg"
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   343
    "Created: / 23.7.1999 / 14:23:38 / stefan"
4504
173da3e8b629 checkin from browser
Stefan Vogel <sv@exept.de>
parents: 4498
diff changeset
   344
    "Modified: / 3.8.1999 / 11:07:34 / stefan"
4481
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   345
!
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   346
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   347
handlerBlock
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   348
    "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
   349
     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
   350
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   351
    ^ nil
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   352
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   353
    "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
   354
    "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
   355
! !
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   356
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   357
!GenericException class methodsFor:'compatibility - queries'!
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   358
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   359
accepts:aSignal
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   360
    "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
   361
     (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
   362
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   363
    |s|
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
    aSignal isQuerySignal ifTrue:[^ false].
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   366
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   367
    s := aSignal.
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   368
    [s notNil] whileTrue:[
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   369
	self == s ifTrue:[^ true].
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   370
	s := s parent
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   371
    ].
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   372
    ^ false
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   373
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   374
    "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
   375
!
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
handlerForSignal:signal context:theContext originator:originator
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   378
    "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
   379
     The block is retrieved from aContext.
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   380
     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
   381
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   382
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   383
    (theContext selector ~~ #'handle:from:do:'
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   384
     or:[(theContext argAt:2) == originator]) ifTrue:[
4513
Claus Gittinger <cg@exept.de>
parents: 4507
diff changeset
   385
        (self == signal or:[self accepts:signal]) ifTrue:[
Claus Gittinger <cg@exept.de>
parents: 4507
diff changeset
   386
            ^ theContext argAt:1
Claus Gittinger <cg@exept.de>
parents: 4507
diff changeset
   387
        ]
4481
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   388
    ].
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   389
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   390
    ^ nil
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   391
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   392
    "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
   393
!
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   394
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   395
handlingExceptionInContext:theContext
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   396
    "answer the handling exception from aContext."
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   397
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   398
    (theContext selector == #'handle:from:do:'
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   399
     or:[theContext selector == #'handle:do:']) ifTrue:[
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   400
        ^ theContext receiver
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   401
    ].
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   402
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   403
    ^ nil
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   404
!
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   405
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   406
inheritsFrom:anotherSignal
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   407
    "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
   408
     (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
   409
     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
   410
     the receiver is identical to anotherSignal."
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   411
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   412
    self == anotherSignal ifTrue:[^ false].
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   413
    ^ anotherSignal accepts:self
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   414
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   415
    "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
   416
!
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
isHandled
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   419
    "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
   420
     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
   421
     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
   422
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   423
    ^ self isHandledIn:(thisContext sender).
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
    "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
   426
!
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
isHandledIn:aContext
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   429
    "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
   430
     contextChain starting with aContext."
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   431
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   432
    |con r|
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   433
4492
ea1fe19f83f2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4491
diff changeset
   434
    con := Context findFirstSpecialHandle:true raise:false.
4481
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   435
    [con notNil] whileTrue:[
4492
ea1fe19f83f2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4491
diff changeset
   436
        ((r := con receiver) notNil
ea1fe19f83f2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4491
diff changeset
   437
         and:[(r handlerForSignal:self context:con originator:nil) notNil]
ea1fe19f83f2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4491
diff changeset
   438
        ) ifTrue:[
ea1fe19f83f2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4491
diff changeset
   439
            "found a handler context"
ea1fe19f83f2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4491
diff changeset
   440
            ^ true
ea1fe19f83f2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4491
diff changeset
   441
        ].
ea1fe19f83f2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4491
diff changeset
   442
        con := con findSpecialHandle:true raise:false.
4481
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   443
    ].
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   444
    ^ false
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   445
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   446
    "Created: / 23.7.1999 / 14:03:34 / stefan"
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   447
    "Modified: / 25.7.1999 / 22:59:03 / stefan"
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   448
!
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   449
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   450
isQuerySignal
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   451
    "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
   452
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   453
    ^ false
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
    "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
   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
isSignal
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 some kind of signal;
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   460
     true returned here - the method is redefined from Object."
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   461
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   462
    ^ true
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
    "Created: / 23.7.1999 / 13:49:59 / stefan"
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   465
!
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
mayProceed
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   468
    "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
   469
     the execution where the exception occured.
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   470
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   471
     Subclasses may redefine this."
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   472
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   473
    ^ true
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   474
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   475
    "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
   476
!
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   477
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   478
parent
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   479
    "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
   480
     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
   481
     existing Signals."
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   482
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   483
    self == GenericException ifTrue:[
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   484
	^ nil
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   485
    ].
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   486
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   487
    ^ self superclass
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   488
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   489
    "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
   490
    "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
   491
! !
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   492
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   493
!GenericException class methodsFor:'compatibility - raising'!
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   494
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   495
new
4496
28f3f57dbe60 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4492
diff changeset
   496
    "{ Pragma: +inlineNew }"
4481
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   497
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   498
    ^ self basicNew signal:self.
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   499
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   500
    "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
   501
    "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
   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
newException
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   505
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   506
    ^ self new
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   507
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   508
    "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
   509
    "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
   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
newExceptionFrom:originator
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   513
    "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
   514
     Set the originator.
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   515
     Subclasses may redefine this method"
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   516
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   517
    ^ self new originator:originator
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   518
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   519
    "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
   520
!
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   521
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   522
raise
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   523
    "raise a signal nonproceedable.
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   524
     The signals notifierString is used as errorString."
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   525
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   526
    ^ self newException raise
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
    "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
   529
    "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
   530
    "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
   531
!
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   532
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   533
raiseErrorString:aString
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   534
    "raise a signal nonproceedable.
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   535
     The argument is used as errorString."
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   536
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   537
    ^ (self newException errorString:aString) raise.
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   538
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   539
    "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
   540
    "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
   541
    "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
   542
!
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   543
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   544
raiseErrorString:aString in:aContext
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   545
    "raise a signal nonproceedable.
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   546
     The argument is used as errorString.
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   547
     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
   548
     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
   549
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   550
    ^ (self newException   
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   551
	      signal:self
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   552
	      parameter:nil 
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   553
	      errorString:aString
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   554
	      suspendedContext:aContext
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   555
	      originator:nil) raise.
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
    "Modified: / 26.7.1996 / 16:42:47 / cg"
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   558
    "Modified: / 12.3.1998 / 15:43:43 / stefan"
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   559
    "Created: / 23.7.1999 / 14:07:48 / stefan"
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   560
!
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
raiseFrom:something
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   563
    "raise a signal nonproceedable.
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   564
     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
   565
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   566
    ^ ((self newExceptionFrom:something) parameter:something) raise
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   567
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   568
    "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
   569
    "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
   570
    "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
   571
!
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   572
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   573
raiseIn:aContext
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   574
    "raise a signal nonproceedable.
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   575
     The signals notifierString is used as errorString.
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   576
     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
   577
     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
   578
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   579
    ^ (self newException suspendedContext:aContext) raise.
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   580
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   581
    "Modified: / 2.5.1996 / 16:36:44 / cg"
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   582
    "Modified: / 5.3.1998 / 16:50:21 / stefan"
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   583
    "Created: / 23.7.1999 / 14:08:13 / stefan"
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   584
!
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   585
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   586
raiseRequest
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   587
    "raise a signal proceedable.
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   588
     The signals notifierString is used as errorString."
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   589
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   590
    ^ self newException raiseRequest.
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   591
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   592
    "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
   593
    "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
   594
    "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
   595
!
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
raiseRequestFrom:something
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   598
    "raise a signal proceedable.
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   599
     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
   600
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   601
    ^ ((self newExceptionFrom:something) parameter:something) raiseRequest.
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   602
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   603
    "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
   604
    "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
   605
    "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
   606
!
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   607
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   608
raiseRequestWith:aParameter
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   609
    "raise a signal proceedable.
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   610
     The signals notifierString is used as errorString."
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   611
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   612
    ^ (self newException parameter:aParameter) raiseRequest.
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   613
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   614
    "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
   615
    "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
   616
    "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
   617
!
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   618
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   619
raiseRequestWith:aParameter errorString:aString
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   620
    "raise a signal proceedable.
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   621
     The argument, aString is used as errorString."
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   622
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   623
    ^ (self newException 
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   624
	      parameter:aParameter; 
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   625
	      errorString:aString
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   626
      ) raiseRequest
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   627
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   628
    "Modified: / 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
   629
    "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
   630
    "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
   631
!
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   632
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   633
raiseRequestWith:aParameter errorString:aString in:aContext
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   634
    "raise a signal proceedable.
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   635
     The argument, aString is used as errorString.
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   636
     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
   637
     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
   638
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   639
    ^ (self newException 
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   640
	      parameter:aParameter; 
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   641
	      errorString:aString;
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   642
	      suspendedContext:aContext) raiseRequest
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
    "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
   645
    "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
   646
    "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
   647
!
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   648
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   649
raiseRequestWith:aParameter in:aContext
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   650
    "raise a signal proceedable.
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   651
     The signals notifierString is used as errorString.
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   652
     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
   653
     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
   654
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   655
    ^ (self newException 
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   656
	      parameter:aParameter; 
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   657
	      suspendedContext:aContext) raiseRequest.
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   658
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   659
    "Modified: / 26.7.1996 / 16:29:33 / cg"
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   660
    "Modified: / 12.3.1998 / 15:18:55 / stefan"
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   661
    "Created: / 23.7.1999 / 14:09:17 / stefan"
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   662
!
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   663
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   664
raiseWith:aParameter
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   665
    "raise a signal nonproceedable.
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   666
     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
   667
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   668
    ^ (self newException parameter:aParameter) raise.
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   669
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   670
    "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
   671
    "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
   672
    "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
   673
!
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   674
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   675
raiseWith:aParameter errorString:aString
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   676
    "raise a signal nonproceedable.
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   677
     The argument, aString is used as errorString, aParameter is passed
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   678
     as exception parameter."
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   679
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   680
    ^ (self newException 
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   681
	      parameter:aParameter;
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   682
	      errorString:aString) raise.
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:14:32 / 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:19:40 / 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:09:36 / 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
raiseWith:aParameter errorString:aString in:aContext
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   690
    "raise a signal nonproceedable.
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   691
     The argument, aString is used as errorString, aParameter is passed
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   692
     as exception parameter.
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   693
     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
   694
     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
   695
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   696
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   697
    ^ (self newException 
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   698
	      parameter:aParameter; 
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   699
	      errorString:aString;
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   700
	      suspendedContext:aContext) raise.
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   701
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   702
    "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
   703
    "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
   704
    "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
   705
!
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   706
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   707
raiseWith:aParameter in:aContext
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   708
    "raise a signal nonproceedable.
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   709
     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
   710
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   711
    ^ (self newException parameter:aParameter;
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   712
			 suspendedContext:aContext) raise.
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   713
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   714
    "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
   715
    "Modified: / 12.3.1998 / 15:34:51 / stefan"
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   716
    "Created: / 23.7.1999 / 14:10:04 / stefan"
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
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   719
!GenericException class methodsFor:'compatibility - save evaluation'!
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   720
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   721
catch:aBlock
4496
28f3f57dbe60 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4492
diff changeset
   722
    "evaluate the argument, aBlock.
28f3f57dbe60 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4492
diff changeset
   723
     If the receiver-signal is raised during evaluation, abort
28f3f57dbe60 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4492
diff changeset
   724
     the evaluation and return true; otherwise return false. 
28f3f57dbe60 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4492
diff changeset
   725
     This is the catch & throw mechanism found in other languages,
28f3f57dbe60 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4492
diff changeset
   726
     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
   727
4496
28f3f57dbe60 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4492
diff changeset
   728
    |raiseOccurred|
4481
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   729
4496
28f3f57dbe60 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4492
diff changeset
   730
    raiseOccurred := false.
28f3f57dbe60 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4492
diff changeset
   731
    self handle:[:ex | raiseOccurred := true. ex return] do:aBlock.
28f3f57dbe60 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4492
diff changeset
   732
    ^ raiseOccurred
4481
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   733
4496
28f3f57dbe60 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4492
diff changeset
   734
    "
28f3f57dbe60 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4492
diff changeset
   735
     Object messageNotUnderstoodSignal catch:[
28f3f57dbe60 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4492
diff changeset
   736
        123 size open   
28f3f57dbe60 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4492
diff changeset
   737
     ]
28f3f57dbe60 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4492
diff changeset
   738
    "
4481
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   739
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   740
    "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
   741
!
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   742
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   743
handle:handleBlock do:aBlock
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   744
    "evaluate the argument, aBlock.
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   745
     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
   746
     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
   747
     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
   748
     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
   749
     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
   750
     aBlock."
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   751
4488
db914d752859 must mark returned contexts as returnable
Claus Gittinger <cg@exept.de>
parents: 4484
diff changeset
   752
    <exception: #handle>
db914d752859 must mark returned contexts as returnable
Claus Gittinger <cg@exept.de>
parents: 4484
diff changeset
   753
4491
5041cae5651c use new pragma to flag exception frames.
Claus Gittinger <cg@exept.de>
parents: 4488
diff changeset
   754
    "/ thisContext markForHandle. -- same as above pragma
5041cae5651c use new pragma to flag exception frames.
Claus Gittinger <cg@exept.de>
parents: 4488
diff changeset
   755
    ^ 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
   756
4491
5041cae5651c use new pragma to flag exception frames.
Claus Gittinger <cg@exept.de>
parents: 4488
diff changeset
   757
    "
5041cae5651c use new pragma to flag exception frames.
Claus Gittinger <cg@exept.de>
parents: 4488
diff changeset
   758
     Object messageNotUnderstoodSignal handle:[:ex |
5041cae5651c use new pragma to flag exception frames.
Claus Gittinger <cg@exept.de>
parents: 4488
diff changeset
   759
        'oops' printNL.
5041cae5651c use new pragma to flag exception frames.
Claus Gittinger <cg@exept.de>
parents: 4488
diff changeset
   760
        ex return
5041cae5651c use new pragma to flag exception frames.
Claus Gittinger <cg@exept.de>
parents: 4488
diff changeset
   761
     ] do:[
5041cae5651c use new pragma to flag exception frames.
Claus Gittinger <cg@exept.de>
parents: 4488
diff changeset
   762
        123 size open   
5041cae5651c use new pragma to flag exception frames.
Claus Gittinger <cg@exept.de>
parents: 4488
diff changeset
   763
     ]
5041cae5651c use new pragma to flag exception frames.
Claus Gittinger <cg@exept.de>
parents: 4488
diff changeset
   764
     "
4481
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   765
4491
5041cae5651c use new pragma to flag exception frames.
Claus Gittinger <cg@exept.de>
parents: 4488
diff changeset
   766
     "
5041cae5651c use new pragma to flag exception frames.
Claus Gittinger <cg@exept.de>
parents: 4488
diff changeset
   767
      |num|
4481
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   768
4491
5041cae5651c use new pragma to flag exception frames.
Claus Gittinger <cg@exept.de>
parents: 4488
diff changeset
   769
      num := 0.
5041cae5651c use new pragma to flag exception frames.
Claus Gittinger <cg@exept.de>
parents: 4488
diff changeset
   770
      Number divisionByZeroSignal handle:[:ex |
5041cae5651c use new pragma to flag exception frames.
Claus Gittinger <cg@exept.de>
parents: 4488
diff changeset
   771
          'oops' printNL.
5041cae5651c use new pragma to flag exception frames.
Claus Gittinger <cg@exept.de>
parents: 4488
diff changeset
   772
          ex return
5041cae5651c use new pragma to flag exception frames.
Claus Gittinger <cg@exept.de>
parents: 4488
diff changeset
   773
      ] do:[
5041cae5651c use new pragma to flag exception frames.
Claus Gittinger <cg@exept.de>
parents: 4488
diff changeset
   774
          123 / num   
5041cae5651c use new pragma to flag exception frames.
Claus Gittinger <cg@exept.de>
parents: 4488
diff changeset
   775
      ]
5041cae5651c use new pragma to flag exception frames.
Claus Gittinger <cg@exept.de>
parents: 4488
diff changeset
   776
     "
4481
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   777
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   778
    "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
   779
    "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
   780
!
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   781
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   782
handle:handleBlock from:anObject do:aBlock
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   783
    "evaluate the argument, aBlock.
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   784
     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
   785
     and the exception originated from anObject,
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   786
     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
   787
     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
   788
     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
   789
     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
   790
     aBlock."
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   791
4488
db914d752859 must mark returned contexts as returnable
Claus Gittinger <cg@exept.de>
parents: 4484
diff changeset
   792
    <exception: #handle>
db914d752859 must mark returned contexts as returnable
Claus Gittinger <cg@exept.de>
parents: 4484
diff changeset
   793
4491
5041cae5651c use new pragma to flag exception frames.
Claus Gittinger <cg@exept.de>
parents: 4488
diff changeset
   794
    "/ thisContext markForHandle. -- same as above pragma
5041cae5651c use new pragma to flag exception frames.
Claus Gittinger <cg@exept.de>
parents: 4488
diff changeset
   795
    ^ 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
   796
4491
5041cae5651c use new pragma to flag exception frames.
Claus Gittinger <cg@exept.de>
parents: 4488
diff changeset
   797
    "
5041cae5651c use new pragma to flag exception frames.
Claus Gittinger <cg@exept.de>
parents: 4488
diff changeset
   798
     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
   799
4491
5041cae5651c use new pragma to flag exception frames.
Claus Gittinger <cg@exept.de>
parents: 4488
diff changeset
   800
     |o1 o2|
4481
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   801
4491
5041cae5651c use new pragma to flag exception frames.
Claus Gittinger <cg@exept.de>
parents: 4488
diff changeset
   802
     o1 := 123.
5041cae5651c use new pragma to flag exception frames.
Claus Gittinger <cg@exept.de>
parents: 4488
diff changeset
   803
     o2 := nil.
5041cae5651c use new pragma to flag exception frames.
Claus Gittinger <cg@exept.de>
parents: 4488
diff changeset
   804
     Object messageNotUnderstoodSignal 
5041cae5651c use new pragma to flag exception frames.
Claus Gittinger <cg@exept.de>
parents: 4488
diff changeset
   805
         handle:
5041cae5651c use new pragma to flag exception frames.
Claus Gittinger <cg@exept.de>
parents: 4488
diff changeset
   806
                [:ex |
5041cae5651c use new pragma to flag exception frames.
Claus Gittinger <cg@exept.de>
parents: 4488
diff changeset
   807
                    'oops' printNL.
5041cae5651c use new pragma to flag exception frames.
Claus Gittinger <cg@exept.de>
parents: 4488
diff changeset
   808
                    ex proceed
5041cae5651c use new pragma to flag exception frames.
Claus Gittinger <cg@exept.de>
parents: 4488
diff changeset
   809
                ] 
5041cae5651c use new pragma to flag exception frames.
Claus Gittinger <cg@exept.de>
parents: 4488
diff changeset
   810
         from:o1
5041cae5651c use new pragma to flag exception frames.
Claus Gittinger <cg@exept.de>
parents: 4488
diff changeset
   811
         do:
5041cae5651c use new pragma to flag exception frames.
Claus Gittinger <cg@exept.de>
parents: 4488
diff changeset
   812
                [
5041cae5651c use new pragma to flag exception frames.
Claus Gittinger <cg@exept.de>
parents: 4488
diff changeset
   813
                    o1 open.
5041cae5651c use new pragma to flag exception frames.
Claus Gittinger <cg@exept.de>
parents: 4488
diff changeset
   814
                    o2 open
5041cae5651c use new pragma to flag exception frames.
Claus Gittinger <cg@exept.de>
parents: 4488
diff changeset
   815
                ]
5041cae5651c use new pragma to flag exception frames.
Claus Gittinger <cg@exept.de>
parents: 4488
diff changeset
   816
    "
4481
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
    "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
   819
    "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
   820
!
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   821
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   822
ignoreIn:aBlock
4496
28f3f57dbe60 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4492
diff changeset
   823
    "evaluate the argument, aBlock.
28f3f57dbe60 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4492
diff changeset
   824
     Ignore the receiver-signal during evaluation - i.e. simply
28f3f57dbe60 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4492
diff changeset
   825
     continue. 
28f3f57dbe60 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4492
diff changeset
   826
     This makes only sense for some signals, such as UserInterrupt
28f3f57dbe60 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4492
diff changeset
   827
     or AbortSignal, because continuing after an exception without any cleanup
28f3f57dbe60 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4492
diff changeset
   828
     often leads to followup-errors."
4481
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   829
4496
28f3f57dbe60 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4492
diff changeset
   830
    ^ 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
   831
4496
28f3f57dbe60 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4492
diff changeset
   832
    "
28f3f57dbe60 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4492
diff changeset
   833
     Object messageNotUnderstoodSignal ignoreIn:[
28f3f57dbe60 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4492
diff changeset
   834
        123 size open   
28f3f57dbe60 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4492
diff changeset
   835
     ]
28f3f57dbe60 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4492
diff changeset
   836
    "
4481
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   837
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   838
    "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
   839
! !
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   840
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   841
!GenericException class methodsFor:'compatibility - signal creation'!
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   842
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   843
newSignal
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   844
    "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
   845
     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
   846
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   847
    ^ self newSignalMayProceed:self mayProceed
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   848
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   849
    "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
   850
!
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   851
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   852
newSignalMayProceed:proceed
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   853
    "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
   854
     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
   855
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   856
    ^ (Signal basicNew) mayProceed:proceed;
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   857
		    notifierString:NotifierString;
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   858
			    parent:self
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
    "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
   861
! !
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   862
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   863
!GenericException class methodsFor:'defaults'!
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   864
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   865
emergencyHandler
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   866
    "return the handler used for unhandled exceptions.
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   867
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   868
     If no EmergencyHandler has been set, a handler which enters the 
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   869
     debugger is returned.
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   870
     The debugger is opened by asking the signal for a debug action,
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   871
     this allows to provide other debuggers in specialized (subclass-instances)
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   872
     of Signal (if that is ever needed)"
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   873
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   874
    "
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   875
     set it up, when called the first time
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   876
    "
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   877
    EmergencyHandler isNil ifTrue:[
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   878
	EmergencyHandler := [:ex |
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   879
	    "
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   880
	     sending it to the signal allows per-signal specific
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   881
	     debuggers to be implemented in the future
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   882
	     (for example, segv in primitive code could show things 
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   883
	      on the C-level ..)
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   884
	    "
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   885
	    (ex signal) enterDebuggerWith:ex message:(ex errorString).
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   886
	]
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   887
    ].
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   888
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   889
    ^ EmergencyHandler
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   890
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   891
    "Modified: 15.1.1997 / 20:50:37 / cg"
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   892
!
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   893
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   894
emergencyHandler:aOneArgBlock
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   895
    "set the handler used for unhandled exceptions.
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   896
     The default (a nil-handler) leads to a debugger to be shown."
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   897
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   898
    EmergencyHandler := aOneArgBlock
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   899
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   900
    "ST-80 behavior of first showing a notifier:
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   901
     (I prefer to get right into the debugger, though)
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   902
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   903
     Exception
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   904
	emergencyHandler:
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   905
	    [:ex | self errorNotify:ex errorString ]
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   906
    "
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   907
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   908
    "ST-X behavior of going right into the debugger:
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   909
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   910
     Exception
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   911
	emergencyHandler:nil
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   912
    "
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   913
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   914
    "automatically aborting current operation, on error:
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   915
     (may be useful for end-user apps; make certain, 
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   916
      you have abortSignal handlers at appropriate places)
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   917
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   918
     Exception
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   919
	emergencyHandler:
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   920
	    [:ex | Object abortSignal raise. ex return. ]
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   921
    "
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   922
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   923
    "finally, traditional language system behavior; dump core ;-)
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   924
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   925
     Exception
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   926
	emergencyHandler:
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   927
	    [:ex | Smalltalk exitWithCoreDump. ]
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   928
    "
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   929
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   930
    "Modified: 15.1.1997 / 20:49:06 / cg"
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   931
! !
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   932
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   933
!GenericException class methodsFor:'useful handlers'!
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   934
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   935
abortingEmergencyHandler
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   936
    "return a block (usable as an emergency handler), 
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   937
     which aborts after showing a warnBox.
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   938
     This is useful for endUser applications"
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   939
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   940
    ^ [:ex | self warn:'Error: ' , ex errorString.
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   941
	     AbortSignal raise 
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
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   944
    "test with (try a few halts or CTRL-C's):
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   945
     Exception emergencyHandler:(Exception abortingEmergencyHandler)
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   946
    "
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   947
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   948
    "back with:
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   949
     Exception emergencyHandler:(Exception notifyingEmergencyHandler)
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   950
     Exception emergencyHandler:nil
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   951
    "
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   952
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   953
    "Created: 15.1.1997 / 20:13:06 / cg"
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   954
    "Modified: 15.1.1997 / 20:15:02 / cg"
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   955
!
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   956
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   957
dumpingEmergencyHandler
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   958
    "return a block (usable as an emergency handler), 
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   959
     which dumps the stackBacktrace to a trace file and
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   960
     aborts after showing a warnBox.
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   961
     This is useful, for endUser application, which are still being
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   962
     debugged (i.e. the programmers may have a look at the traceFile
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   963
     from time to time).
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   964
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   965
     Notice:
4484
9476c82921d0 eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents: 4483
diff changeset
   966
         The code below is just an example; you may want to change the
9476c82921d0 eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents: 4483
diff changeset
   967
         name of the error-file in your application
9476c82921d0 eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents: 4483
diff changeset
   968
         (but please: copy the code; do not modify here)"
4481
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   969
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   970
    ^ [:ex | 
4484
9476c82921d0 eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents: 4483
diff changeset
   971
             |str printedException|
4481
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   972
4517
8c539600fb63 Implement NoHandlerException etc. as class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4513
diff changeset
   973
             ex signal == NoHandlerError ifTrue:[
4484
9476c82921d0 eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents: 4483
diff changeset
   974
                printedException := ex parameter.
9476c82921d0 eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents: 4483
diff changeset
   975
             ] ifFalse:[
9476c82921d0 eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents: 4483
diff changeset
   976
                printedException := ex
9476c82921d0 eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents: 4483
diff changeset
   977
             ].
4481
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   978
4484
9476c82921d0 eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents: 4483
diff changeset
   979
             "/ user interruption is handled specially:
9476c82921d0 eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents: 4483
diff changeset
   980
             "/ allow user to choose between proceeding or aborting
9476c82921d0 eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents: 4483
diff changeset
   981
             "/ but never dump that information to the file.
4481
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   982
4484
9476c82921d0 eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents: 4483
diff changeset
   983
             printedException signal == Object userInterruptSignal ifTrue:[
9476c82921d0 eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents: 4483
diff changeset
   984
                  (self confirm:'abort current action ?') ifTrue:[
9476c82921d0 eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents: 4483
diff changeset
   985
                      AbortSignal raise
9476c82921d0 eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents: 4483
diff changeset
   986
                  ].
9476c82921d0 eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents: 4483
diff changeset
   987
                  ex proceedWith:nil
9476c82921d0 eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents: 4483
diff changeset
   988
             ].
4481
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   989
4484
9476c82921d0 eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents: 4483
diff changeset
   990
             "/
9476c82921d0 eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents: 4483
diff changeset
   991
             "/ dump it to 'errorTrace.stx'
9476c82921d0 eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents: 4483
diff changeset
   992
             "/
9476c82921d0 eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents: 4483
diff changeset
   993
             str := 'errorTrace.stx' asFilename appendingWriteStream.
4481
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   994
4484
9476c82921d0 eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents: 4483
diff changeset
   995
             str nextPutLine:('******************************* '
9476c82921d0 eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents: 4483
diff changeset
   996
                              , AbsoluteTime now printString
9476c82921d0 eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents: 4483
diff changeset
   997
                              , ' *******************************').
9476c82921d0 eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents: 4483
diff changeset
   998
             str cr.
4481
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   999
4484
9476c82921d0 eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents: 4483
diff changeset
  1000
             str nextPutLine:('** Error: ' , printedException errorString).
9476c82921d0 eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents: 4483
diff changeset
  1001
             str nextPutLine:('** Signal: ' , printedException signal printString).
9476c82921d0 eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents: 4483
diff changeset
  1002
             str nextPutLine:('** Parameter: ' , printedException parameter printString).
9476c82921d0 eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents: 4483
diff changeset
  1003
             str nextPutLine:('** Process: ' , Processor activeProcess printString).
9476c82921d0 eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents: 4483
diff changeset
  1004
             str nextPutLine:('** Backtrace:').
9476c82921d0 eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents: 4483
diff changeset
  1005
             str cr.
4481
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1006
        
4484
9476c82921d0 eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents: 4483
diff changeset
  1007
             printedException suspendedContext fullPrintAllOn:str.
9476c82921d0 eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents: 4483
diff changeset
  1008
             str cr.
9476c82921d0 eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents: 4483
diff changeset
  1009
             str cr.
9476c82921d0 eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents: 4483
diff changeset
  1010
             str close.
4481
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1011
4484
9476c82921d0 eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents: 4483
diff changeset
  1012
             "/ send a line to stdErr
4481
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1013
4484
9476c82921d0 eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents: 4483
diff changeset
  1014
             ('[warning]: ignored error: ' , printedException errorString) errorPrintCR.
9476c82921d0 eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents: 4483
diff changeset
  1015
             ('[warning]:    error information appended to ''errorTrace.stx''') errorPrintCR.
4481
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1016
4484
9476c82921d0 eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents: 4483
diff changeset
  1017
             AbortSignal raise 
4481
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1018
      ]
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1019
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1020
    "test with (try a few halts or CTRL-C's):
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1021
     Exception emergencyHandler:(Exception dumpingEmergencyHandler)
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1022
    "
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1023
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1024
    "back with:
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1025
     Exception emergencyHandler:(Exception notifyingEmergencyHandler)
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1026
     Exception emergencyHandler:nil
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1027
    "
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1028
4517
8c539600fb63 Implement NoHandlerException etc. as class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4513
diff changeset
  1029
    "Created: / 15.1.1997 / 20:14:52 / cg"
8c539600fb63 Implement NoHandlerException etc. as class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4513
diff changeset
  1030
    "Modified: / 24.1.1997 / 20:36:21 / cg"
8c539600fb63 Implement NoHandlerException etc. as class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4513
diff changeset
  1031
    "Modified: / 4.8.1999 / 08:11:20 / stefan"
4481
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1032
!
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
mailingEmergencyHandler
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1035
    "return a block (usable as an emergency handler), 
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1036
     which shows a warnBox and optionally mails a stackBacktrace to a maintainer.
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1037
     This is useful, for endUser application, which are still being
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1038
     debugged (i.e. the programmers may have a look at the errors).
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1039
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1040
     Notice: the stuff here is a demonstration only; it should be modified
4484
9476c82921d0 eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents: 4483
diff changeset
  1041
             for your particular environment ...
9476c82921d0 eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents: 4483
diff changeset
  1042
             ... but please: copy the code and modify there;
9476c82921d0 eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents: 4483
diff changeset
  1043
             leave the stuff below as it is."
4481
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1044
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1045
    ^ [:ex | 
4484
9476c82921d0 eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents: 4483
diff changeset
  1046
            |str printedException doMail emergencyMailReceiver pipe|
4481
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1047
4517
8c539600fb63 Implement NoHandlerException etc. as class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4513
diff changeset
  1048
            ex signal == NoHandlerError ifTrue:[
4484
9476c82921d0 eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents: 4483
diff changeset
  1049
               printedException := ex parameter.
9476c82921d0 eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents: 4483
diff changeset
  1050
            ] ifFalse:[
9476c82921d0 eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents: 4483
diff changeset
  1051
               printedException := ex
9476c82921d0 eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents: 4483
diff changeset
  1052
            ].
4481
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1053
4484
9476c82921d0 eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents: 4483
diff changeset
  1054
             "/ user interruption is handled specially:
9476c82921d0 eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents: 4483
diff changeset
  1055
             "/ allow user to choose between proceeding or aborting
9476c82921d0 eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents: 4483
diff changeset
  1056
             "/ but never dump that information to the file.
4481
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1057
4484
9476c82921d0 eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents: 4483
diff changeset
  1058
             printedException signal == Object userInterruptSignal ifTrue:[
9476c82921d0 eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents: 4483
diff changeset
  1059
                  (self confirm:'abort current action ?') ifTrue:[
9476c82921d0 eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents: 4483
diff changeset
  1060
                      AbortSignal raise
9476c82921d0 eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents: 4483
diff changeset
  1061
                  ].
9476c82921d0 eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents: 4483
diff changeset
  1062
                  ex proceedWith:nil
9476c82921d0 eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents: 4483
diff changeset
  1063
             ].
4481
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1064
4484
9476c82921d0 eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents: 4483
diff changeset
  1065
            "/ somehow get the name of the guy to receive the mail
9476c82921d0 eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents: 4483
diff changeset
  1066
            "/ you have to implement that yourself.
4481
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1067
4484
9476c82921d0 eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents: 4483
diff changeset
  1068
            "/ emergencyMailReceiver := OneOfYourClass getEmergencyMailReceiver.
9476c82921d0 eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents: 4483
diff changeset
  1069
            emergencyMailReceiver := OperatingSystem getLoginName.
4481
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1070
4484
9476c82921d0 eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents: 4483
diff changeset
  1071
            emergencyMailReceiver isNil ifTrue:[
9476c82921d0 eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents: 4483
diff changeset
  1072
                self warn:(printedException errorString 
9476c82921d0 eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents: 4483
diff changeset
  1073
                           , '\\No mailing to service people possible.') withCRs.
9476c82921d0 eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents: 4483
diff changeset
  1074
                doMail := false.
9476c82921d0 eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents: 4483
diff changeset
  1075
            ] ifFalse:[
9476c82921d0 eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents: 4483
diff changeset
  1076
                doMail := self confirm:(printedException errorString 
9476c82921d0 eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents: 4483
diff changeset
  1077
                                        , '\\Mail error information to the service people (' 
9476c82921d0 eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents: 4483
diff changeset
  1078
                                        , emergencyMailReceiver , ') ?') withCRs
9476c82921d0 eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents: 4483
diff changeset
  1079
            ].
9476c82921d0 eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents: 4483
diff changeset
  1080
            doMail ifTrue:[
9476c82921d0 eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents: 4483
diff changeset
  1081
                str := '' writeStream.
4481
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1082
4484
9476c82921d0 eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents: 4483
diff changeset
  1083
                str nextPutLine:('Error notification from '
9476c82921d0 eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents: 4483
diff changeset
  1084
                                , OperatingSystem getLoginName
9476c82921d0 eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents: 4483
diff changeset
  1085
                                , '@'
9476c82921d0 eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents: 4483
diff changeset
  1086
                                , OperatingSystem getHostName).
9476c82921d0 eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents: 4483
diff changeset
  1087
                str cr.
4481
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1088
4484
9476c82921d0 eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents: 4483
diff changeset
  1089
                str nextPutLine:('Time: ' , AbsoluteTime now printString).
9476c82921d0 eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents: 4483
diff changeset
  1090
                str nextPutLine:('Error: ', printedException errorString).
9476c82921d0 eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents: 4483
diff changeset
  1091
                str nextPutLine:('Signal: ', printedException signal printString).
9476c82921d0 eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents: 4483
diff changeset
  1092
                str nextPutLine:('Parameter: ', printedException parameter printString).
9476c82921d0 eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents: 4483
diff changeset
  1093
                str nextPutLine:('Process: ', Processor activeProcess printString).
9476c82921d0 eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents: 4483
diff changeset
  1094
                str nextPutLine:'Backtrace:'.
9476c82921d0 eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents: 4483
diff changeset
  1095
                str cr.
4481
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1096
4484
9476c82921d0 eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents: 4483
diff changeset
  1097
                printedException suspendedContext fullPrintAllOn:str.
9476c82921d0 eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents: 4483
diff changeset
  1098
                str cr;cr.
4481
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1099
4484
9476c82921d0 eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents: 4483
diff changeset
  1100
                str close.
4481
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1101
4484
9476c82921d0 eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents: 4483
diff changeset
  1102
                pipe := PipeStream 
9476c82921d0 eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents: 4483
diff changeset
  1103
                            writingTo:'mail ', emergencyMailReceiver.
9476c82921d0 eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents: 4483
diff changeset
  1104
                pipe notNil ifTrue:[
9476c82921d0 eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents: 4483
diff changeset
  1105
                    pipe nextPutLine:'Subject: automatic error report'.
9476c82921d0 eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents: 4483
diff changeset
  1106
                    pipe nextPutAll:str contents.
9476c82921d0 eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents: 4483
diff changeset
  1107
                    pipe cr.
9476c82921d0 eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents: 4483
diff changeset
  1108
                    pipe close.
9476c82921d0 eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents: 4483
diff changeset
  1109
                ]
9476c82921d0 eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents: 4483
diff changeset
  1110
             ].
4481
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1111
4484
9476c82921d0 eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents: 4483
diff changeset
  1112
             AbortSignal raise 
4481
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1113
      ]
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1114
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1115
    "test with (try a few halts or CTRL-C's):
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1116
     Exception emergencyHandler:(Exception mailingEmergencyHandler)
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1117
    "
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1118
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1119
    "back with:
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1120
     Exception emergencyHandler:(Exception notifyingEmergencyHandler)
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1121
     Exception emergencyHandler:nil
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1122
    "
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1123
4517
8c539600fb63 Implement NoHandlerException etc. as class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4513
diff changeset
  1124
    "Created: / 15.1.1997 / 20:14:52 / cg"
8c539600fb63 Implement NoHandlerException etc. as class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4513
diff changeset
  1125
    "Modified: / 15.1.1997 / 21:10:28 / cg"
8c539600fb63 Implement NoHandlerException etc. as class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4513
diff changeset
  1126
    "Modified: / 4.8.1999 / 08:11:26 / stefan"
4481
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1127
!
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1128
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1129
notifyingEmergencyHandler
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1130
    "return a block (usable as an emergency handler for exceptions), 
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1131
     which does errorNotification before going into the debugger."
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1132
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1133
    ^ [:ex | nil errorNotify:ex errorString from:ex suspendedContext ]
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1134
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1135
    "test with (try a few halts or CTRL-C's):
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1136
     Exception emergencyHandler:(Exception notifyingEmergencyHandler)
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1137
    "
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1138
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1139
    "back with:
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1140
     Exception emergencyHandler:nil
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1141
    "
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1142
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1143
    "Modified: 15.1.1997 / 20:15:12 / cg"
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1144
! !
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1145
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1146
!GenericException methodsFor:'accessing'!
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1147
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1148
errorString 
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1149
    "return the errorString passsed with the signal raise
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1150
     (or nil, if there was none)"
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1151
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1152
    ^ signal errorStringExtra:errorString with:nil
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1153
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1154
    "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
  1155
!
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1156
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1157
errorString:aString 
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1158
    "set the errorString.
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1159
     If it starts with a space, the signals errorString is prepended,
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1160
     if it ends with a space, it is appended."
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1161
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1162
    errorString := aString
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1163
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1164
    "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
  1165
    "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
  1166
!
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1167
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1168
handlerContext
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1169
    "return the context of the handler"
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1170
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1171
    ^ handlerContext
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1172
!
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1173
4483
55530226d243 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4481
diff changeset
  1174
handlingException
55530226d243 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4481
diff changeset
  1175
    "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
  1176
     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
  1177
     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
  1178
     (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
  1179
4483
55530226d243 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4481
diff changeset
  1180
    ^ handlingException
4481
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1181
!
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1182
4484
9476c82921d0 eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents: 4483
diff changeset
  1183
isResumable
9476c82921d0 eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents: 4483
diff changeset
  1184
    "return true, if the exception is resumable"
9476c82921d0 eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents: 4483
diff changeset
  1185
9476c82921d0 eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents: 4483
diff changeset
  1186
    ^ proceedable
9476c82921d0 eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents: 4483
diff changeset
  1187
9476c82921d0 eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents: 4483
diff changeset
  1188
    "Modified: / 2.3.1998 / 12:20:43 / stefan"
9476c82921d0 eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents: 4483
diff changeset
  1189
!
9476c82921d0 eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents: 4483
diff changeset
  1190
4481
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1191
originator 
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1192
    "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
  1193
     (or nil, if there was none)"
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1194
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1195
    ^ originator
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1196
!
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1197
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1198
originator:anObject 
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1199
    "set the originator"
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1200
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1201
    originator := anObject
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1202
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1203
    "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
  1204
!
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1205
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1206
parameter
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1207
    "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
  1208
     (or nil, if there was none)"
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1209
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1210
    ^ parameter
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1211
!
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1212
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1213
parameter:anObject
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1214
    "set the parameter of the exception"
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1215
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1216
    parameter := anObject
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1217
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1218
    "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
  1219
!
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1220
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1221
rejected
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1222
    "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
  1223
     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
  1224
     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
  1225
     (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
  1226
     rejected).
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1227
     Currently only used to change the 'unhandled-exception' errorString 
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1228
     into 'rejected-exception' for information).
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1229
    "
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1230
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1231
    ^ rejected
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1232
!
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1233
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1234
signal
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1235
    "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
  1236
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1237
    ^ signal
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1238
!
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1239
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1240
signal:aSignal
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1241
    "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
  1242
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1243
    signal := aSignal
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1244
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1245
    "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
  1246
!
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1247
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1248
suspendedContext
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1249
    "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
  1250
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1251
    ^ suspendedContext
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1252
!
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1253
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1254
suspendedContext:something
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1255
    "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
  1256
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1257
    suspendedContext := something.
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1258
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1259
    "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
  1260
!
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1261
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1262
willProceed
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1263
    "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
  1264
4484
9476c82921d0 eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents: 4483
diff changeset
  1265
    ^ self isResumable
4481
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1266
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1267
    "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
  1268
! !
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1269
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1270
!GenericException methodsFor:'copying'!
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1271
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1272
postCopy
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1273
    "set the internal state to nil"
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1274
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1275
    suspendedContext := handlerContext := rejected := nil
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1276
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1277
    "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
  1278
! !
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1279
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1280
!GenericException methodsFor:'default actions'!
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1281
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1282
action
4484
9476c82921d0 eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents: 4483
diff changeset
  1283
    "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
  1284
     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
  1285
     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
  1286
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1287
     The default is to evaluate the signal's handlerBlock or the
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1288
     per process handler (if its the noHandlerSignal).
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1289
     Finally fall back to Exceptions emergencyHandler, which is always
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1290
     available and enters the debugger.
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1291
     Subclasses may redefine this."
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1292
4517
8c539600fb63 Implement NoHandlerException etc. as class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4513
diff changeset
  1293
    |block msg|
4481
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1294
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1295
    "
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1296
     try per signal handler
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1297
    "
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1298
    (block := signal handlerBlock) isNil ifTrue:[
4484
9476c82921d0 eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents: 4483
diff changeset
  1299
        "/
9476c82921d0 eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents: 4483
diff changeset
  1300
        "/ if its a querySignal, ignore it
9476c82921d0 eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents: 4483
diff changeset
  1301
        "/
9476c82921d0 eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents: 4483
diff changeset
  1302
        signal isQuerySignal ifTrue:[^ nil].
4481
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1303
4484
9476c82921d0 eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents: 4483
diff changeset
  1304
        "/
9476c82921d0 eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents: 4483
diff changeset
  1305
        "/ if it is not the NoHandlerSignal, raise it ...
9476c82921d0 eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents: 4483
diff changeset
  1306
        "/ passing the receiver as parameter.
9476c82921d0 eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents: 4483
diff changeset
  1307
        "/
4517
8c539600fb63 Implement NoHandlerException etc. as class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4513
diff changeset
  1308
        signal ~~ NoHandlerError ifTrue:[
8c539600fb63 Implement NoHandlerException etc. as class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4513
diff changeset
  1309
            NoHandlerError notNil ifTrue:[
4484
9476c82921d0 eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents: 4483
diff changeset
  1310
                handlerContext notNil ifTrue:[
9476c82921d0 eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents: 4483
diff changeset
  1311
                    msg := 'unhandled (rejected)'
9476c82921d0 eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents: 4483
diff changeset
  1312
                ] ifFalse:[
9476c82921d0 eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents: 4483
diff changeset
  1313
                    msg := 'unhandled'
9476c82921d0 eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents: 4483
diff changeset
  1314
                ].
9476c82921d0 eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents: 4483
diff changeset
  1315
                msg := msg , ' exception: (' , self errorString , ')'.
4517
8c539600fb63 Implement NoHandlerException etc. as class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4513
diff changeset
  1316
                ^ NoHandlerError 
4484
9476c82921d0 eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents: 4483
diff changeset
  1317
                      raiseRequestWith:self 
9476c82921d0 eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents: 4483
diff changeset
  1318
                      errorString:msg
9476c82921d0 eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents: 4483
diff changeset
  1319
                      in:self suspendedContext
9476c82921d0 eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents: 4483
diff changeset
  1320
            ].
9476c82921d0 eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents: 4483
diff changeset
  1321
            "/
9476c82921d0 eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents: 4483
diff changeset
  1322
            "/ mhmh - an error during early startup; noHandlerSignal is
9476c82921d0 eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents: 4483
diff changeset
  1323
            "/ not yet defined.
9476c82921d0 eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents: 4483
diff changeset
  1324
            "/
9476c82921d0 eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents: 4483
diff changeset
  1325
            ^ MiniDebugger enterWithMessage:self errorString
9476c82921d0 eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents: 4483
diff changeset
  1326
        ].
4481
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1327
4484
9476c82921d0 eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents: 4483
diff changeset
  1328
        "
9476c82921d0 eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents: 4483
diff changeset
  1329
         mhmh - smells like trouble - there is no handler and
9476c82921d0 eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents: 4483
diff changeset
  1330
         no per-signal handler block.
9476c82921d0 eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents: 4483
diff changeset
  1331
         Look for either a per-process emergencyHandlerBlock 
9476c82921d0 eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents: 4483
diff changeset
  1332
         or the global emergencyHandler (from Exception) ...
9476c82921d0 eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents: 4483
diff changeset
  1333
        "
9476c82921d0 eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents: 4483
diff changeset
  1334
        Processor notNil ifTrue:[ 
9476c82921d0 eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents: 4483
diff changeset
  1335
            "care for signal during startup (Processor not yet created)"
9476c82921d0 eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents: 4483
diff changeset
  1336
            block := Processor activeProcess emergencySignalHandler.
9476c82921d0 eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents: 4483
diff changeset
  1337
        ].
9476c82921d0 eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents: 4483
diff changeset
  1338
        block isNil ifTrue:[
9476c82921d0 eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents: 4483
diff changeset
  1339
            block := Exception emergencyHandler.
9476c82921d0 eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents: 4483
diff changeset
  1340
            block isNil ifTrue:[
9476c82921d0 eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents: 4483
diff changeset
  1341
                "care for error during startup (Exception not yet initialized)"
9476c82921d0 eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents: 4483
diff changeset
  1342
                ^ MiniDebugger enterWithMessage:self errorString
9476c82921d0 eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents: 4483
diff changeset
  1343
            ].
9476c82921d0 eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents: 4483
diff changeset
  1344
        ].
4481
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1345
    ].
4484
9476c82921d0 eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents: 4483
diff changeset
  1346
4481
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1347
    "... and call it"
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1348
    ^ block value:self.
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1349
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1350
    "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
  1351
    "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
  1352
!
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1353
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1354
mayProceed
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1355
    "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
  1356
     the execution where the exception occured.
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1357
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1358
     Subclasses may redefine this."
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1359
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1360
    ^ signal mayProceed
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1361
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1362
    "Created: / 23.7.1999 / 14:48:26 / stefan"
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1363
! !
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1364
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1365
!GenericException methodsFor:'handler actions'!
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1366
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1367
proceed
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1368
    "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
  1369
4517
8c539600fb63 Implement NoHandlerException etc. as class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4513
diff changeset
  1370
    proceedable ifFalse:[
8c539600fb63 Implement NoHandlerException etc. as class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4513
diff changeset
  1371
        "proceed from ProceedError to recover from this error"
8c539600fb63 Implement NoHandlerException etc. as class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4513
diff changeset
  1372
        ProceedError raiseRequestWith:self in:thisContext sender.
8c539600fb63 Implement NoHandlerException etc. as class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4513
diff changeset
  1373
        proceedable := true.
8c539600fb63 Implement NoHandlerException etc. as class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4513
diff changeset
  1374
    ].
4484
9476c82921d0 eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents: 4483
diff changeset
  1375
    self proceedWith:nil.
4481
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1376
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1377
    "
4484
9476c82921d0 eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents: 4483
diff changeset
  1378
     Object errorSignal handle:[:ex|
9476c82921d0 eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents: 4483
diff changeset
  1379
         ex proceed
9476c82921d0 eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents: 4483
diff changeset
  1380
     ] do:[
4517
8c539600fb63 Implement NoHandlerException etc. as class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4513
diff changeset
  1381
         Object errorSignal raiseRequest
4484
9476c82921d0 eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents: 4483
diff changeset
  1382
     ].
4481
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1383
    "
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1384
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1385
    "Modified: / 27.3.1997 / 16:44:39 / cg"
4517
8c539600fb63 Implement NoHandlerException etc. as class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4513
diff changeset
  1386
    "Modified: / 4.8.1999 / 08:42:12 / stefan"
4481
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1387
!
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1388
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1389
proceedWith:value
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1390
    "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
  1391
4507
c15d849b1ddc Remove unused vars.
Stefan Vogel <sv@exept.de>
parents: 4504
diff changeset
  1392
    |con|
4484
9476c82921d0 eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents: 4483
diff changeset
  1393
9476c82921d0 eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents: 4483
diff changeset
  1394
    proceedable ifFalse:[
4517
8c539600fb63 Implement NoHandlerException etc. as class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4513
diff changeset
  1395
        "proceed from ProceedError to recover from this error"
8c539600fb63 Implement NoHandlerException etc. as class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4513
diff changeset
  1396
        ProceedError raiseRequestWith:self in:thisContext sender.
8c539600fb63 Implement NoHandlerException etc. as class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4513
diff changeset
  1397
        proceedable := true.
4484
9476c82921d0 eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents: 4483
diff changeset
  1398
    ].
9476c82921d0 eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents: 4483
diff changeset
  1399
9476c82921d0 eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents: 4483
diff changeset
  1400
    "/ find my raise context
9476c82921d0 eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents: 4483
diff changeset
  1401
    con := Context findFirstSpecialHandle:false raise:true.
9476c82921d0 eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents: 4483
diff changeset
  1402
    [con notNil 
9476c82921d0 eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents: 4483
diff changeset
  1403
     and:[con receiver ~~ self]] whileTrue:[
9476c82921d0 eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents: 4483
diff changeset
  1404
        con := con findSpecialHandle:false raise:true.
9476c82921d0 eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents: 4483
diff changeset
  1405
    ].
9476c82921d0 eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents: 4483
diff changeset
  1406
    "/ now, have the doCallXXX context at-hand
4488
db914d752859 must mark returned contexts as returnable
Claus Gittinger <cg@exept.de>
parents: 4484
diff changeset
  1407
    con := con sender.
db914d752859 must mark returned contexts as returnable
Claus Gittinger <cg@exept.de>
parents: 4484
diff changeset
  1408
    "/ now, have the doRaise context at-hand
4481
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1409
4484
9476c82921d0 eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents: 4483
diff changeset
  1410
    handlerContext := suspendedContext := nil.
9476c82921d0 eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents: 4483
diff changeset
  1411
    con unwind:value.
4481
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1412
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1413
    "Modified: / 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
  1414
    "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
  1415
!
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1416
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1417
reject
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1418
    "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
  1419
     system will look for another handler"
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1420
4484
9476c82921d0 eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents: 4483
diff changeset
  1421
    |con|
9476c82921d0 eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents: 4483
diff changeset
  1422
9476c82921d0 eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents: 4483
diff changeset
  1423
    "/ find my raise context
9476c82921d0 eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents: 4483
diff changeset
  1424
    con := Context findFirstSpecialHandle:false raise:true.
9476c82921d0 eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents: 4483
diff changeset
  1425
    [con notNil 
9476c82921d0 eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents: 4483
diff changeset
  1426
     and:[con receiver ~~ self]] whileTrue:[
9476c82921d0 eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents: 4483
diff changeset
  1427
        con := con findSpecialHandle:false raise:true.
9476c82921d0 eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents: 4483
diff changeset
  1428
    ].
4488
db914d752859 must mark returned contexts as returnable
Claus Gittinger <cg@exept.de>
parents: 4484
diff changeset
  1429
    "/ 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
  1430
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1431
    rejected := true.
4484
9476c82921d0 eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents: 4483
diff changeset
  1432
    con unwind:nil.
4481
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1433
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1434
    "
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1435
     Object errorSignal handle:[:ex |
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1436
        '1' printCR.
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1437
        ex reject
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1438
     ] do:[
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1439
        Object errorSignal handle:[:ex |
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1440
            '2' printCR.
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1441
            ex reject
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1442
        ] do:[
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1443
            #() at:1
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1444
        ]
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1445
     ]
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1446
    "
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1447
!
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1448
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1449
restart
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1450
    "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
  1451
     in the handler"
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1452
4484
9476c82921d0 eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents: 4483
diff changeset
  1453
    |con|
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
    con := handlerContext.
9476c82921d0 eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents: 4483
diff changeset
  1456
    handlerContext := suspendedContext := nil.
9476c82921d0 eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents: 4483
diff changeset
  1457
    con unwindAndRestart
4481
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1458
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1459
    "
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1460
     |rslt n|
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1461
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1462
     Object errorSignal handle:[:ex |
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1463
        'fixing divisor ...' printCR.
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1464
        n := 1.
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1465
        ex restart.
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1466
     ] do:[
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1467
        rslt := 5 / n.
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1468
     ].
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1469
     rslt
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1470
    "
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1471
!
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1472
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1473
restartDo:aBlock
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1474
    "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
  1475
     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
  1476
4484
9476c82921d0 eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents: 4483
diff changeset
  1477
    |con|
9476c82921d0 eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents: 4483
diff changeset
  1478
9476c82921d0 eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents: 4483
diff changeset
  1479
    con := handlerContext.
9476c82921d0 eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents: 4483
diff changeset
  1480
9476c82921d0 eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents: 4483
diff changeset
  1481
    con selector == #'handle:do:' ifFalse:[
4481
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1482
        self error:'unimplemented feature'.
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1483
    ].
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1484
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1485
"/    handlerContext unwindThenDo:[
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1486
"/        handlerContext receiver 
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1487
"/            handle:(handlerContext argAt:1)
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1488
"/            do:aBlock
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1489
"/    ].
4484
9476c82921d0 eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents: 4483
diff changeset
  1490
    handlerContext := suspendedContext := nil.
9476c82921d0 eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents: 4483
diff changeset
  1491
    con argAt:2 put:aBlock.
9476c82921d0 eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents: 4483
diff changeset
  1492
    con unwindAndRestart
4481
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1493
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
     |sig rslt|
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1496
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1497
     sig := Signal new.
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1498
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1499
     sig handle:[:ex |
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1500
        ex restartDo:[ rslt := 999 ]
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1501
     ] do:[
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1502
        rslt := 0.
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1503
        sig raise
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1504
     ].
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1505
     Transcript showCR:rslt
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1506
    "
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
    "
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1509
     |sig rslt|
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1510
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1511
     Object errorSignal handle:[:ex |
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1512
        ex restartDo:[ rslt := 999 ]
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1513
     ] do:[
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1514
        rslt := nil foo.
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1515
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1516
     ].
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1517
     Transcript showCR:rslt
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1518
    "
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1519
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1520
    "
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1521
     |sig rslt|
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1522
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1523
     Object errorSignal handle:[:ex |
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1524
        ex restartDo:[ 'handler' printCR. rslt := nil foo ]
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1525
     ] do:[
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1526
        rslt := nil foo.
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1527
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1528
     ].
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1529
     Transcript showCR:rslt
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1530
    "
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1531
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1532
    "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
  1533
!
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
resume
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1536
    "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
  1537
     obsolete (use #proceed), retained for backwards compatibility"
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1538
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1539
    self obsoleteMethodWarning:'use #proceed'.
4484
9476c82921d0 eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents: 4483
diff changeset
  1540
    ^ self proceedWith:nil
4481
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1541
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1542
    "Modified: / 2.3.1998 / 10:51:55 / stefan"
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1543
!
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1544
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1545
resumeWith:value
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1546
    "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
  1547
     obsolete (use #proceedWith:), retained for backwards compatibility"
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
    self obsoleteMethodWarning:'use #proceedWith:'.
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1550
    ^ self proceedWith:value
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1551
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1552
    "Modified: / 2.3.1998 / 10:51:48 / stefan"
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1553
!
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1554
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1555
return
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1556
    "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
  1557
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1558
    |con|
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
    con := handlerContext.
4484
9476c82921d0 eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents: 4483
diff changeset
  1561
    handlerContext := suspendedContext := nil.
4481
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1562
    con unwind:nil
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1563
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1564
    "Modified: 27.3.1997 / 16:46:39 / cg"
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1565
!
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
returnDoing:aBlock
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1568
    "Continue after the handle:do: - the handle:do: returns aBlock value"
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1569
4484
9476c82921d0 eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents: 4483
diff changeset
  1570
    |con|
9476c82921d0 eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents: 4483
diff changeset
  1571
9476c82921d0 eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents: 4483
diff changeset
  1572
    con := handlerContext.
9476c82921d0 eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents: 4483
diff changeset
  1573
    handlerContext := suspendedContext := nil.
9476c82921d0 eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents: 4483
diff changeset
  1574
    con unwindThenDo:aBlock
4481
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1575
!
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
returnWith:value
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1578
    "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
  1579
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1580
    |con|
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1581
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1582
    con := handlerContext.
4484
9476c82921d0 eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents: 4483
diff changeset
  1583
    handlerContext := suspendedContext := nil.
4481
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1584
    con unwind:value
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1585
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1586
    "Modified: 27.3.1997 / 16:46:51 / cg"
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1587
! !
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1588
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1589
!GenericException methodsFor:'private'!
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1590
4484
9476c82921d0 eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents: 4483
diff changeset
  1591
doCallAction
9476c82921d0 eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents: 4483
diff changeset
  1592
    "call the action proper 
9476c82921d0 eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents: 4483
diff changeset
  1593
     - 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
  1594
       ( see implementation of #reject and #proceed)."
9476c82921d0 eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents: 4483
diff changeset
  1595
4488
db914d752859 must mark returned contexts as returnable
Claus Gittinger <cg@exept.de>
parents: 4484
diff changeset
  1596
    <context: #return>
db914d752859 must mark returned contexts as returnable
Claus Gittinger <cg@exept.de>
parents: 4484
diff changeset
  1597
    <exception: #raise>
db914d752859 must mark returned contexts as returnable
Claus Gittinger <cg@exept.de>
parents: 4484
diff changeset
  1598
4491
5041cae5651c use new pragma to flag exception frames.
Claus Gittinger <cg@exept.de>
parents: 4488
diff changeset
  1599
    "/ thisContext markForRaise. -- same as above pragma
4484
9476c82921d0 eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents: 4483
diff changeset
  1600
    ^ self action
9476c82921d0 eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents: 4483
diff changeset
  1601
!
9476c82921d0 eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents: 4483
diff changeset
  1602
4481
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1603
doCallHandler:aHandlerBlock
4484
9476c82921d0 eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents: 4483
diff changeset
  1604
    "call the handler proper 
9476c82921d0 eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents: 4483
diff changeset
  1605
     - 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
  1606
       ( 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
  1607
4488
db914d752859 must mark returned contexts as returnable
Claus Gittinger <cg@exept.de>
parents: 4484
diff changeset
  1608
    <context: #return>
db914d752859 must mark returned contexts as returnable
Claus Gittinger <cg@exept.de>
parents: 4484
diff changeset
  1609
    <exception: #raise>
db914d752859 must mark returned contexts as returnable
Claus Gittinger <cg@exept.de>
parents: 4484
diff changeset
  1610
4481
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1611
    |val|
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1612
4491
5041cae5651c use new pragma to flag exception frames.
Claus Gittinger <cg@exept.de>
parents: 4488
diff changeset
  1613
    "/ thisContext markForRaise. -- same as above pragma
4481
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1614
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1615
    val := aHandlerBlock value:self.
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
     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
  1618
    "
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1619
    self returnWith:val
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1620
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1621
    "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
  1622
!
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1623
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1624
doRaise
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1625
    "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
  1626
     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
  1627
     the raising signal.
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1628
     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
  1629
     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
  1630
     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
  1631
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1632
     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
  1633
     #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
  1634
4488
db914d752859 must mark returned contexts as returnable
Claus Gittinger <cg@exept.de>
parents: 4484
diff changeset
  1635
    <context: #return>
db914d752859 must mark returned contexts as returnable
Claus Gittinger <cg@exept.de>
parents: 4484
diff changeset
  1636
4481
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1637
    |theContext handler
4484
9476c82921d0 eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents: 4483
diff changeset
  1638
     theSignal c ex1 activeHandlers 
4504
173da3e8b629 checkin from browser
Stefan Vogel <sv@exept.de>
parents: 4498
diff changeset
  1639
     "lastHandler" h r firstHandler searchForHandle|
4481
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1640
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1641
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1642
    "/ is nil a valid originator? If so, we need an extra
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1643
    "/ instanceVariable to record the originator setting.
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
    originator isNil ifTrue:[
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1646
        originator := suspendedContext homeReceiver
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1647
    ].
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1648
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1649
    theSignal := signal.
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1650
    theSignal isSignal ifFalse:[
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1651
        self halt:'unexpected non-Signal in calling context'.
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1652
    ].
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1653
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1654
"/ 'search handler for: ' print. theSignal displayString printCR.
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1655
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1656
    "/ since the exceptionHandler is evaluated on top of the
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1657
    "/ contextChain, we must skip active handlers before searching.
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1658
    "/ otherwise, we get into trouble, when re-raising an exception
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1659
    "/ from within a handler (which would lead to re-executing the
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1660
    "/ same handler)
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1661
    "/ the code below collects active handlers ...
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1662
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1663
    "/ on the fly, look for the first handle - context,
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1664
    "/ and remember it (as firstHandler) to avoid walking the context chain twice
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1665
    "/ in most cases ...
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1666
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1667
    firstHandler := nil.
4504
173da3e8b629 checkin from browser
Stefan Vogel <sv@exept.de>
parents: 4498
diff changeset
  1668
    searchForHandle := true.
4481
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1669
4504
173da3e8b629 checkin from browser
Stefan Vogel <sv@exept.de>
parents: 4498
diff changeset
  1670
    c := Context findFirstSpecialHandle:searchForHandle raise:true.
4481
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1671
4484
9476c82921d0 eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents: 4483
diff changeset
  1672
    [c notNil] whileTrue:[
9476c82921d0 eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents: 4483
diff changeset
  1673
        (c isRaiseContext) ifTrue:[
9476c82921d0 eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents: 4483
diff changeset
  1674
            ex1 := c receiver.
9476c82921d0 eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents: 4483
diff changeset
  1675
            ((ex1 class == self class)
9476c82921d0 eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents: 4483
diff changeset
  1676
            or:[ex1 species == self species]) ifTrue:[
9476c82921d0 eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents: 4483
diff changeset
  1677
                h := ex1 handlerContext.
9476c82921d0 eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents: 4483
diff changeset
  1678
                h notNil ifTrue:[
9476c82921d0 eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents: 4483
diff changeset
  1679
                    ((ex1 signal == theSignal)
4481
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1680
4484
9476c82921d0 eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents: 4483
diff changeset
  1681
                    "/ mhmh - if not ==, the raised signal there is not ours, 
9476c82921d0 eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents: 4483
diff changeset
  1682
                    "/ but the handler could still be for a signalSet, parentSig
9476c82921d0 eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents: 4483
diff changeset
  1683
                    "/ or other thingy which accepts our signal.
4504
173da3e8b629 checkin from browser
Stefan Vogel <sv@exept.de>
parents: 4498
diff changeset
  1684
                    "/ If we omit that check, a signalSet-handler gets invoked
4484
9476c82921d0 eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents: 4483
diff changeset
  1685
                    "/ again by an exception occuring inside its handler.
4481
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1686
4484
9476c82921d0 eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents: 4483
diff changeset
  1687
                    "/ to avoid overhead, only do it if the
9476c82921d0 eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents: 4483
diff changeset
  1688
                    "/ handlers receiver is not of the signals class...
9476c82921d0 eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents: 4483
diff changeset
  1689
                    "/ ...i.e. knowing that most are r handle:do: contexts,
9476c82921d0 eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents: 4483
diff changeset
  1690
                    "/ where the receiver is the handling signal.
9476c82921d0 eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents: 4483
diff changeset
  1691
                    or:[h receiver ~~ ex1 signal
9476c82921d0 eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents: 4483
diff changeset
  1692
                        and:[ex1 handlingException accepts:theSignal]]) ifTrue:[
9476c82921d0 eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents: 4483
diff changeset
  1693
                        activeHandlers isNil ifTrue:[
9476c82921d0 eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents: 4483
diff changeset
  1694
                            activeHandlers := OrderedCollection new
9476c82921d0 eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents: 4483
diff changeset
  1695
                        ].
4481
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1696
4484
9476c82921d0 eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents: 4483
diff changeset
  1697
                        activeHandlers add:h.
9476c82921d0 eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents: 4483
diff changeset
  1698
                        "/ lastHandler := h.
9476c82921d0 eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents: 4483
diff changeset
  1699
                        c := h.
4481
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1700
                    ]
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1701
                ]
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1702
            ]
4484
9476c82921d0 eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents: 4483
diff changeset
  1703
        ] ifFalse:[
9476c82921d0 eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents: 4483
diff changeset
  1704
            "/ must be a handle context ...
9476c82921d0 eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents: 4483
diff changeset
  1705
            firstHandler := c.
9476c82921d0 eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents: 4483
diff changeset
  1706
            searchForHandle := false.
9476c82921d0 eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents: 4483
diff changeset
  1707
        ].
4504
173da3e8b629 checkin from browser
Stefan Vogel <sv@exept.de>
parents: 4498
diff changeset
  1708
        c := c findSpecialHandle:searchForHandle raise:true.
4481
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1709
    ].
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1710
4484
9476c82921d0 eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents: 4483
diff changeset
  1711
    h := nil.
9476c82921d0 eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents: 4483
diff changeset
  1712
    c := nil.
9476c82921d0 eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents: 4483
diff changeset
  1713
4481
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1714
    "/ now, start searching for a handler,
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1715
    "/ start search above the last active handler.
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1716
    "/ Or start with the first handle context, if one
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1717
    "/ was found as a side effect of the previous handler search.
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1718
    "/ If nil, then there is no handler and we can directly proceed
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1719
    "/ to the unhandled code below.
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1720
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1721
"/    lastHandler notNil ifTrue:[
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1722
"/        theContext := lastHandler.
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1723
"/        theContext := lastHandler findNextHandleContext
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1724
"/    ] ifFalse:[
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1725
        theContext := firstHandler.
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1726
"/    ].
4484
9476c82921d0 eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents: 4483
diff changeset
  1727
    firstHandler := nil.
4481
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1728
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1729
    [theContext notNil] whileTrue:[
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1730
        "/
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1731
        "/  ask the Signal instance/Exception class for the handler.
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1732
        "/  nil is returned, if the signal is not accepted
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1733
        "/
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1734
        r := theContext receiver.
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1735
        (r notNil and:[(handler := r handlerForSignal:signal 
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1736
                                     context:theContext 
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1737
                                     originator:originator) notNil]
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1738
        ) ifTrue:[
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1739
            (activeHandlers notNil
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1740
             and:[activeHandlers includesIdentical:theContext]) ifTrue:[
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1741
"/                'skip activeHandler: ' print. theContext displayString printCR.
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
            ] ifFalse:[
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1744
                "call the handler"
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1745
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1746
                handlerContext := theContext.
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1747
                "/ remember the handling signal, sigSet, or exception
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1748
                "/ for the #accepts: check above
4483
55530226d243 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4481
diff changeset
  1749
                handlingException := r handlingExceptionInContext:theContext.
4481
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1750
                theContext := nil.
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1751
                self doCallHandler:handler.
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1752
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1753
                "/ if the handler rejects, we arrive here
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1754
                "/ continue search for another handler
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1755
                theContext := handlerContext.
4484
9476c82921d0 eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents: 4483
diff changeset
  1756
                handlerContext := nil.
4481
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1757
            ].
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1758
        ].
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1759
        theContext := theContext findSpecialHandle:true raise:false.
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1760
    ].
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1761
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1762
    "/ help GC a bit, by clearing things we no longer need
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1763
    "/ (especially useful for contexts ...)
4484
9476c82921d0 eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents: 4483
diff changeset
  1764
    activeHandlers := handler := ex1 := firstHandler := nil.
4481
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1765
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1766
    "
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1767
     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
  1768
     or every handler rejected.
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1769
    "
4484
9476c82921d0 eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents: 4483
diff changeset
  1770
    ^ self doCallAction
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
    "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
  1773
    "Modified: / 9.11.1997 / 14:48:44 / cg"
4504
173da3e8b629 checkin from browser
Stefan Vogel <sv@exept.de>
parents: 4498
diff changeset
  1774
    "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
  1775
! !
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1776
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1777
!GenericException methodsFor:'raising'!
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1778
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1779
raise
4484
9476c82921d0 eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents: 4483
diff changeset
  1780
    "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
  1781
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1782
    suspendedContext isNil ifTrue:[
4484
9476c82921d0 eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents: 4483
diff changeset
  1783
        "Call chain:
9476c82921d0 eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents: 4483
diff changeset
  1784
           (origin)>>someMethod         sender
9476c82921d0 eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents: 4483
diff changeset
  1785
           Signal>>raise                sender
9476c82921d0 eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents: 4483
diff changeset
  1786
           Exception>>raise             thisContext
9476c82921d0 eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents: 4483
diff changeset
  1787
        "
9476c82921d0 eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents: 4483
diff changeset
  1788
        suspendedContext := thisContext sender sender
4481
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1789
    ].
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1790
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1791
    proceedable := false.
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1792
    ^ self doRaise
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1793
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1794
    "Modified: / 12.5.1996 / 15:09:47 / cg"
4507
c15d849b1ddc Remove unused vars.
Stefan Vogel <sv@exept.de>
parents: 4504
diff changeset
  1795
    "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
  1796
!
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1797
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1798
raiseRequest
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1799
    "actually raise a proceedable exception."
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1800
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1801
    suspendedContext isNil ifTrue:[
4484
9476c82921d0 eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents: 4483
diff changeset
  1802
        "Call chain:
9476c82921d0 eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents: 4483
diff changeset
  1803
           (origin)>>someMethod         sender
9476c82921d0 eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents: 4483
diff changeset
  1804
           Signal>>raise                sender
9476c82921d0 eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents: 4483
diff changeset
  1805
           Exception>>raise             thisContext
9476c82921d0 eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents: 4483
diff changeset
  1806
        "
9476c82921d0 eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents: 4483
diff changeset
  1807
        suspendedContext := thisContext sender sender
4481
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1808
    ].
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1809
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1810
    self mayProceed ifFalse:[
4484
9476c82921d0 eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents: 4483
diff changeset
  1811
        "/ proceeding from wrongProceedabilitySignal grants the raiseRequest
4517
8c539600fb63 Implement NoHandlerException etc. as class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4513
diff changeset
  1812
        WrongProceedabilityError raiseRequestWith:signal in:suspendedContext
4481
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1813
    ].
4484
9476c82921d0 eliminated proceedBlock and rejectBlock;
Claus Gittinger <cg@exept.de>
parents: 4483
diff changeset
  1814
4481
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1815
    proceedable := true.
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1816
    ^ self doRaise
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1817
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1818
    "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
  1819
    "Modified: / 4.8.1999 / 08:05:12 / stefan"
4481
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1820
! !
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1821
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1822
!GenericException methodsFor:'setup'!
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1823
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1824
signal:aSignal originator:origin
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1825
    "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
  1826
     - 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
  1827
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1828
    signal := aSignal.
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1829
    originator := origin.
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
    "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
  1832
!
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1833
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1834
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
  1835
    "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
  1836
     - 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
  1837
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1838
    signal := aSignal.
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1839
    parameter := aParameter.
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1840
    errorString := aString.
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1841
    suspendedContext := sContext.
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1842
    originator := origin.
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
4517
8c539600fb63 Implement NoHandlerException etc. as class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4513
diff changeset
  1845
!GenericException::WrongProceedabilityError class methodsFor:'documentation'!
8c539600fb63 Implement NoHandlerException etc. as class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4513
diff changeset
  1846
8c539600fb63 Implement NoHandlerException etc. as class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4513
diff changeset
  1847
documentation
8c539600fb63 Implement NoHandlerException etc. as class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4513
diff changeset
  1848
"    
8c539600fb63 Implement NoHandlerException etc. as class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4513
diff changeset
  1849
    WrongProceedabilityError is raised to indicate that someone tries
8c539600fb63 Implement NoHandlerException etc. as class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4513
diff changeset
  1850
    to raise a nonproceedable exception proceedable.
8c539600fb63 Implement NoHandlerException etc. as class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4513
diff changeset
  1851
8c539600fb63 Implement NoHandlerException etc. as class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4513
diff changeset
  1852
    The parameter is the unproceedable signal.
8c539600fb63 Implement NoHandlerException etc. as class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4513
diff changeset
  1853
"
8c539600fb63 Implement NoHandlerException etc. as class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4513
diff changeset
  1854
8c539600fb63 Implement NoHandlerException etc. as class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4513
diff changeset
  1855
! !
8c539600fb63 Implement NoHandlerException etc. as class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4513
diff changeset
  1856
8c539600fb63 Implement NoHandlerException etc. as class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4513
diff changeset
  1857
!GenericException::WrongProceedabilityError class methodsFor:'initialization'!
8c539600fb63 Implement NoHandlerException etc. as class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4513
diff changeset
  1858
8c539600fb63 Implement NoHandlerException etc. as class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4513
diff changeset
  1859
initialize
8c539600fb63 Implement NoHandlerException etc. as class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4513
diff changeset
  1860
8c539600fb63 Implement NoHandlerException etc. as class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4513
diff changeset
  1861
    NotifierString := 'attempt to raise a nonproceedable signal proceedable'.
8c539600fb63 Implement NoHandlerException etc. as class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4513
diff changeset
  1862
8c539600fb63 Implement NoHandlerException etc. as class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4513
diff changeset
  1863
    "
8c539600fb63 Implement NoHandlerException etc. as class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4513
diff changeset
  1864
     self initialize
8c539600fb63 Implement NoHandlerException etc. as class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4513
diff changeset
  1865
    "
8c539600fb63 Implement NoHandlerException etc. as class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4513
diff changeset
  1866
8c539600fb63 Implement NoHandlerException etc. as class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4513
diff changeset
  1867
    "Created: / 4.8.1999 / 08:02:32 / stefan"
8c539600fb63 Implement NoHandlerException etc. as class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4513
diff changeset
  1868
    "Modified: / 4.8.1999 / 08:02:54 / stefan"
8c539600fb63 Implement NoHandlerException etc. as class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4513
diff changeset
  1869
! !
8c539600fb63 Implement NoHandlerException etc. as class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4513
diff changeset
  1870
8c539600fb63 Implement NoHandlerException etc. as class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4513
diff changeset
  1871
!GenericException::WrongProceedabilityError class methodsFor:'queries'!
8c539600fb63 Implement NoHandlerException etc. as class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4513
diff changeset
  1872
8c539600fb63 Implement NoHandlerException etc. as class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4513
diff changeset
  1873
mayProceed
8c539600fb63 Implement NoHandlerException etc. as class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4513
diff changeset
  1874
8c539600fb63 Implement NoHandlerException etc. as class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4513
diff changeset
  1875
    ^ true
8c539600fb63 Implement NoHandlerException etc. as class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4513
diff changeset
  1876
8c539600fb63 Implement NoHandlerException etc. as class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4513
diff changeset
  1877
    "Created: / 4.8.1999 / 08:02:32 / stefan"
8c539600fb63 Implement NoHandlerException etc. as class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4513
diff changeset
  1878
! !
8c539600fb63 Implement NoHandlerException etc. as class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4513
diff changeset
  1879
8c539600fb63 Implement NoHandlerException etc. as class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4513
diff changeset
  1880
!GenericException::NoHandlerError class methodsFor:'documentation'!
8c539600fb63 Implement NoHandlerException etc. as class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4513
diff changeset
  1881
8c539600fb63 Implement NoHandlerException etc. as class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4513
diff changeset
  1882
documentation
8c539600fb63 Implement NoHandlerException etc. as class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4513
diff changeset
  1883
"
8c539600fb63 Implement NoHandlerException etc. as class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4513
diff changeset
  1884
    NoHandlerError is raised, if there is no exception handler
8c539600fb63 Implement NoHandlerException etc. as class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4513
diff changeset
  1885
    or default action for an exception.
8c539600fb63 Implement NoHandlerException etc. as class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4513
diff changeset
  1886
8c539600fb63 Implement NoHandlerException etc. as class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4513
diff changeset
  1887
    The parameter is the unhandled exception.
8c539600fb63 Implement NoHandlerException etc. as class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4513
diff changeset
  1888
"
8c539600fb63 Implement NoHandlerException etc. as class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4513
diff changeset
  1889
8c539600fb63 Implement NoHandlerException etc. as class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4513
diff changeset
  1890
! !
8c539600fb63 Implement NoHandlerException etc. as class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4513
diff changeset
  1891
8c539600fb63 Implement NoHandlerException etc. as class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4513
diff changeset
  1892
!GenericException::NoHandlerError class methodsFor:'initialization'!
8c539600fb63 Implement NoHandlerException etc. as class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4513
diff changeset
  1893
8c539600fb63 Implement NoHandlerException etc. as class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4513
diff changeset
  1894
initialize
8c539600fb63 Implement NoHandlerException etc. as class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4513
diff changeset
  1895
8c539600fb63 Implement NoHandlerException etc. as class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4513
diff changeset
  1896
    NotifierString := 'unhandled exception'.
8c539600fb63 Implement NoHandlerException etc. as class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4513
diff changeset
  1897
8c539600fb63 Implement NoHandlerException etc. as class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4513
diff changeset
  1898
    "
8c539600fb63 Implement NoHandlerException etc. as class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4513
diff changeset
  1899
     self initialize
8c539600fb63 Implement NoHandlerException etc. as class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4513
diff changeset
  1900
    "
8c539600fb63 Implement NoHandlerException etc. as class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4513
diff changeset
  1901
8c539600fb63 Implement NoHandlerException etc. as class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4513
diff changeset
  1902
    "Created: / 4.8.1999 / 08:07:30 / stefan"
8c539600fb63 Implement NoHandlerException etc. as class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4513
diff changeset
  1903
    "Modified: / 4.8.1999 / 08:08:05 / stefan"
8c539600fb63 Implement NoHandlerException etc. as class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4513
diff changeset
  1904
! !
8c539600fb63 Implement NoHandlerException etc. as class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4513
diff changeset
  1905
8c539600fb63 Implement NoHandlerException etc. as class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4513
diff changeset
  1906
!GenericException::NoHandlerError class methodsFor:'queries'!
8c539600fb63 Implement NoHandlerException etc. as class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4513
diff changeset
  1907
8c539600fb63 Implement NoHandlerException etc. as class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4513
diff changeset
  1908
mayProceed
8c539600fb63 Implement NoHandlerException etc. as class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4513
diff changeset
  1909
8c539600fb63 Implement NoHandlerException etc. as class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4513
diff changeset
  1910
    ^ true
8c539600fb63 Implement NoHandlerException etc. as class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4513
diff changeset
  1911
8c539600fb63 Implement NoHandlerException etc. as class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4513
diff changeset
  1912
    "Created: / 4.8.1999 / 08:07:30 / stefan"
8c539600fb63 Implement NoHandlerException etc. as class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4513
diff changeset
  1913
! !
8c539600fb63 Implement NoHandlerException etc. as class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4513
diff changeset
  1914
8c539600fb63 Implement NoHandlerException etc. as class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4513
diff changeset
  1915
!GenericException::ProceedError class methodsFor:'documentation'!
8c539600fb63 Implement NoHandlerException etc. as class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4513
diff changeset
  1916
8c539600fb63 Implement NoHandlerException etc. as class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4513
diff changeset
  1917
documentation
8c539600fb63 Implement NoHandlerException etc. as class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4513
diff changeset
  1918
"
8c539600fb63 Implement NoHandlerException etc. as class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4513
diff changeset
  1919
    ProceedError is raised to indicate that a handler tried to
8c539600fb63 Implement NoHandlerException etc. as class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4513
diff changeset
  1920
    proceed an exception marked as nonproceedable.
8c539600fb63 Implement NoHandlerException etc. as class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4513
diff changeset
  1921
8c539600fb63 Implement NoHandlerException etc. as class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4513
diff changeset
  1922
    The parameter is the exception which tried to proceed.
8c539600fb63 Implement NoHandlerException etc. as class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4513
diff changeset
  1923
8c539600fb63 Implement NoHandlerException etc. as class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4513
diff changeset
  1924
    NOTE: In the past ST/X didn't distinguish between proceedable
8c539600fb63 Implement NoHandlerException etc. as class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4513
diff changeset
  1925
          and non-proceedable exceptions. To make transistion easier,
8c539600fb63 Implement NoHandlerException etc. as class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4513
diff changeset
  1926
          this exception is a warning for now. In a future release of
8c539600fb63 Implement NoHandlerException etc. as class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4513
diff changeset
  1927
          ST/X, this exception will be changed to be an error.
8c539600fb63 Implement NoHandlerException etc. as class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4513
diff changeset
  1928
          Please fix your code.
8c539600fb63 Implement NoHandlerException etc. as class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4513
diff changeset
  1929
"
8c539600fb63 Implement NoHandlerException etc. as class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4513
diff changeset
  1930
8c539600fb63 Implement NoHandlerException etc. as class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4513
diff changeset
  1931
! !
8c539600fb63 Implement NoHandlerException etc. as class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4513
diff changeset
  1932
8c539600fb63 Implement NoHandlerException etc. as class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4513
diff changeset
  1933
!GenericException::ProceedError class methodsFor:'initialization'!
8c539600fb63 Implement NoHandlerException etc. as class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4513
diff changeset
  1934
8c539600fb63 Implement NoHandlerException etc. as class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4513
diff changeset
  1935
initialize
8c539600fb63 Implement NoHandlerException etc. as class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4513
diff changeset
  1936
8c539600fb63 Implement NoHandlerException etc. as class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4513
diff changeset
  1937
    NotifierString := 'handler tried to proceed from nonproceedable exception'.
8c539600fb63 Implement NoHandlerException etc. as class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4513
diff changeset
  1938
8c539600fb63 Implement NoHandlerException etc. as class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4513
diff changeset
  1939
    "
8c539600fb63 Implement NoHandlerException etc. as class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4513
diff changeset
  1940
     self initialize
8c539600fb63 Implement NoHandlerException etc. as class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4513
diff changeset
  1941
    "
8c539600fb63 Implement NoHandlerException etc. as class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4513
diff changeset
  1942
8c539600fb63 Implement NoHandlerException etc. as class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4513
diff changeset
  1943
    "Created: / 4.8.1999 / 07:36:14 / stefan"
8c539600fb63 Implement NoHandlerException etc. as class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4513
diff changeset
  1944
! !
8c539600fb63 Implement NoHandlerException etc. as class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4513
diff changeset
  1945
8c539600fb63 Implement NoHandlerException etc. as class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4513
diff changeset
  1946
!GenericException::ProceedError class methodsFor:'queries'!
8c539600fb63 Implement NoHandlerException etc. as class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4513
diff changeset
  1947
8c539600fb63 Implement NoHandlerException etc. as class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4513
diff changeset
  1948
mayProceed
8c539600fb63 Implement NoHandlerException etc. as class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4513
diff changeset
  1949
8c539600fb63 Implement NoHandlerException etc. as class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4513
diff changeset
  1950
    ^ true
8c539600fb63 Implement NoHandlerException etc. as class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4513
diff changeset
  1951
8c539600fb63 Implement NoHandlerException etc. as class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4513
diff changeset
  1952
    "Created: / 4.8.1999 / 07:35:07 / stefan"
8c539600fb63 Implement NoHandlerException etc. as class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4513
diff changeset
  1953
! !
8c539600fb63 Implement NoHandlerException etc. as class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4513
diff changeset
  1954
8c539600fb63 Implement NoHandlerException etc. as class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4513
diff changeset
  1955
!GenericException::ProceedError methodsFor:'handler actions'!
8c539600fb63 Implement NoHandlerException etc. as class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4513
diff changeset
  1956
8c539600fb63 Implement NoHandlerException etc. as class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4513
diff changeset
  1957
action
8c539600fb63 Implement NoHandlerException etc. as class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4513
diff changeset
  1958
    "make proceeding from a non-proceedable raise a warning for now.
8c539600fb63 Implement NoHandlerException etc. as class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4513
diff changeset
  1959
     This will change in future revisions"
8c539600fb63 Implement NoHandlerException etc. as class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4513
diff changeset
  1960
8c539600fb63 Implement NoHandlerException etc. as class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4513
diff changeset
  1961
    ('WARNING: signal <', parameter signal printString, '> has been raised nonproceedable') errorPrintCR.
8c539600fb63 Implement NoHandlerException etc. as class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4513
diff changeset
  1962
    ('         by: ', parameter suspendedContext printString) errorPrintCR.
8c539600fb63 Implement NoHandlerException etc. as class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4513
diff changeset
  1963
    ('         ', suspendedContext printString , ' tries to proceed.') errorPrintCR.
8c539600fb63 Implement NoHandlerException etc. as class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4513
diff changeset
  1964
    ('         This will be an error in future ST/X versions.') errorPrintCR.
8c539600fb63 Implement NoHandlerException etc. as class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4513
diff changeset
  1965
8c539600fb63 Implement NoHandlerException etc. as class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4513
diff changeset
  1966
    self proceedWith:nil.
8c539600fb63 Implement NoHandlerException etc. as class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4513
diff changeset
  1967
8c539600fb63 Implement NoHandlerException etc. as class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4513
diff changeset
  1968
    "
8c539600fb63 Implement NoHandlerException etc. as class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4513
diff changeset
  1969
      Object errorSignal handle:[:ex|
8c539600fb63 Implement NoHandlerException etc. as class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4513
diff changeset
  1970
         ex proceedWith:nil
8c539600fb63 Implement NoHandlerException etc. as class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4513
diff changeset
  1971
      ] do:[
8c539600fb63 Implement NoHandlerException etc. as class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4513
diff changeset
  1972
         Object errorSignal raise
8c539600fb63 Implement NoHandlerException etc. as class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4513
diff changeset
  1973
      ].
8c539600fb63 Implement NoHandlerException etc. as class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4513
diff changeset
  1974
8c539600fb63 Implement NoHandlerException etc. as class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4513
diff changeset
  1975
      Object errorSignal handle:[:ex|
8c539600fb63 Implement NoHandlerException etc. as class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4513
diff changeset
  1976
         ex proceed
8c539600fb63 Implement NoHandlerException etc. as class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4513
diff changeset
  1977
      ] do:[
8c539600fb63 Implement NoHandlerException etc. as class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4513
diff changeset
  1978
         Object errorSignal raise
8c539600fb63 Implement NoHandlerException etc. as class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4513
diff changeset
  1979
      ].
8c539600fb63 Implement NoHandlerException etc. as class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4513
diff changeset
  1980
    "
8c539600fb63 Implement NoHandlerException etc. as class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4513
diff changeset
  1981
8c539600fb63 Implement NoHandlerException etc. as class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4513
diff changeset
  1982
    "Created: / 4.8.1999 / 07:48:49 / stefan"
8c539600fb63 Implement NoHandlerException etc. as class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4513
diff changeset
  1983
    "Modified: / 4.8.1999 / 08:43:53 / stefan"
8c539600fb63 Implement NoHandlerException etc. as class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4513
diff changeset
  1984
! !
8c539600fb63 Implement NoHandlerException etc. as class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4513
diff changeset
  1985
4481
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1986
!GenericException class methodsFor:'documentation'!
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1987
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1988
version
4517
8c539600fb63 Implement NoHandlerException etc. as class based exceptions.
Stefan Vogel <sv@exept.de>
parents: 4513
diff changeset
  1989
    ^ '$Header: /cvs/stx/stx/libbasic/GenericException.st,v 1.12 1999-08-04 06:57:13 stefan Exp $'
4481
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1990
! !
f3f7e1af7489 added GenericException in-between, to allow for some exceptions
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1991
GenericException initialize!