|
|
6.128 Signal
- Defined in namespace Smalltalk
- Category: Language-Exceptions
My instances describe an exception that has happened, and are passed to
exception handlers. Apart from containing information on the generated
exception and its arguments, they contain methods that allow you to resume
execution, leave the #on:do:... snippet, and pass the exception to an handler
with a lower priority.
6.128.1 Signal: accessing
- argument
- Answer the first argument of the receiver
- argumentCount
- Answer how many arguments the receiver has
- arguments
- Answer the arguments of the receiver
- basicMessageText
- Answer an exception's message text. Do not override this method.
- description
- Answer the description of the raised exception
- exception
- Answer the CoreException that was raised
- 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.
6.128.2 Signal: exception handling
- defaultAction
- Execute the default handler for the raised exception
- isNested
- Answer whether the current exception handler is within the scope of another handler for the same exception.
- isResumable
- Answer whether the exception that instantiated the receiver is resumable.
- 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 arguments 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 anObject to its caller
- return: anObject
- Exit the #on:do: snippet, answering anObject to its caller
|