Back: Error-exception description Up: Base classes Forward: Exception class-comparison   Top: GNU Smalltalk Library Reference Contents: Table of Contents Index: Class index About: About this document

1.70 Exception

Defined in namespace Smalltalk
Superclass: Object
Category: Language-Exceptions

My instances describe an exception that has happened, and are passed to exception handlers. Classes describe the kind of exception.

Apart from containing information on the generated exception, my instances contain methods that allow you to resume execution, leave the #on:do:... block, and pass the exception to an handler with a lower priority.

1.70.1 Exception class: comparison  (class)
1.70.2 Exception class: creating ExceptionCollections  (class)
1.70.3 Exception class: instance creation  (class)
1.70.4 Exception class: interoperability with TrappableEvents  (class)
1.70.5 Exception: accessing  (instance)
1.70.6 Exception: built ins  (instance)
1.70.7 Exception: comparison  (instance)
1.70.8 Exception: copying  (instance)
1.70.9 Exception: exception description  (instance)
1.70.10 Exception: exception handling  (instance)
1.70.11 Exception: exception signaling  (instance)
1.70.12 Exception: still unclassified  (instance)


1.70.1 Exception class: comparison

goodness: anExceptionClass
Answer how good the receiver is at handling the given exception. A negative value indicates that the receiver is not able to handle the exception.

handles: anException
Answer whether the receiver handles `anException'.


1.70.2 Exception class: creating ExceptionCollections

, aTrappableEvent
Answer an ExceptionCollection containing all the exceptions in the receiver and all the exceptions in aTrappableEvent


1.70.3 Exception class: instance creation

new
Create an instance of the receiver, which you will be able to signal later.

signal
Create an instance of the receiver, give it default attributes, and signal it immediately.

signal: messageText
Create an instance of the receiver, set its message text, and signal it immediately.


1.70.4 Exception class: interoperability with TrappableEvents

allExceptionsDo: aBlock
Private - Pass ourselves to aBlock


1.70.5 Exception: accessing

basicMessageText
Answer an exception's message text. Do not override this method.

messageText
Answer an exception's message text.

messageText: aString
Set an exception's message text.

tag
Answer an exception's tag value. If not specified, it is the same as the message text.

tag: anObject
Set an exception's tag value. If nil, the tag value will be the same as the message text.


1.70.6 Exception: built ins

resignalAsUnhandled: message
This might start the debugger... Note that we use #basicPrint 'cause #printOn: might invoke an error.


1.70.7 Exception: comparison

= anObject
Answer whether the receiver is equal to anObject. This is true if either the receiver or its class are the same object as anObject.


1.70.8 Exception: copying

postCopy
Modify the receiver so that it does not refer to any instantiated exception handler.


1.70.9 Exception: exception description

defaultAction
Execute the default action that is attached to the receiver.

description
Answer a textual description of the exception.

isResumable
Answer true. Exceptions are by default resumable.


1.70.10 Exception: exception handling

context
Return the execution context for the #on:do: snippet

isNested
Answer whether the current exception handler is within the scope of another handler for the same exception.

outer
Raise the exception that instantiated the receiver, passing the same parameters. If the receiver is resumable and the evaluated exception action resumes then the result returned from #outer will be the resumption value of the evaluated exception action. If the receiver is not resumable or if the exception action does not resume then this message will not return, and #outer will be equivalent to #pass.

pass
Yield control to the enclosing exception action for the receiver. Similar to #outer, but control does not return to the currently active exception handler.

resignalAs: replacementException
Reinstate all handlers and execute the handler for `replacementException'; control does not return to the currently active exception handler. The new Signal object that is created has the same contents as the receiver (this might or not be correct -- if it isn't you can use an idiom such as `sig retryUsing: [ replacementException signal ])

resume
If the exception is resumable, resume the execution of the block that raised the exception; the method that was used to signal the exception will answer the receiver. Use this method IF AND ONLY IF you know who caused the exception and if it is possible to resume it in that particular case

resume: anObject
If the exception is resumable, resume the execution of the block that raised the exception; the method that was used to signal the exception will answer anObject. Use this method IF AND ONLY IF you know who caused the exception and if it is possible to resume it in that particular case

retry
Re-execute the receiver of the #on:do: message. All handlers are reinstated: watch out, this can easily cause an infinite loop.

retryUsing: aBlock
Execute aBlock reinstating all handlers, and return its result from the #signal method.

return
Exit the #on:do: snippet, answering nil to its caller.

return: anObject
Exit the #on:do: snippet, answering anObject to its caller.


1.70.11 Exception: exception signaling

signal
Raise the exceptional event represented by the receiver

signal: messageText
Raise the exceptional event represented by the receiver, setting its message text to messageText.


1.70.12 Exception: still unclassified

signalingContext
Return the execution context for the place that signaled the exception, or nil if it is not available anymore (for example if the exception handler has returned.



Back: Exception-exception signaling Up: Exception Forward: ExceptionSet   Top: GNU Smalltalk Library Reference Contents: Table of Contents Index: Class index About: About this document


This document was generated on February, 22 2012 using texi2html