next up previous contents index
Next: 3.13 Concurrency Up: 3 The Slate World Previous: 3.11 Paths   Contents   Index


3.12 Exceptional Situations and Errors

Slate has a special kind of object representing when an exceptional situation has been reached in a program, called a Condition. Condition objects may have attributes and methods like other ordinary objects, but have special methods for dealing with exceptional situations and recovering from them in various ways, often automatically.

3.12.1 Types

An object representing a situation which must be handled. This also provides a hook for working with the control-flow of the situation, and dynamic unwinding of control.
An object representing and controlling how a condition is handled. Because they are a kind of Condition, they can themselves be handled dynamically.
A Condition which should generate notifications, but does not need to be raised for handling, i.e. no action needs to be taken. Raised by warn: with a description.
A Warning that certain conventions set up by the library author have not been followed, which could lead to problems. Raised by note: with a description.
A Condition that pauses the current computation. Raised by break in a context.
A Restart which unwinds the stack and cleans up contexts after a condition is raised. This is raised by the context method abort.
A Condition that requires handling, but is not a semantic error of the program. Rather, it's due to some incidental or pragmatic consideration.
A SeriousCondition which involves some misstep in program logic, and raises the need for handlers to avoid a program crash. Raised by error: with a description.

3.12.2 Protocol

Raises the exception that is the argument. This will immediately query for exception handlers in the current context, performing dynamic automatic recovery if possible, or starting the debugger if not.
Executes the block of code with a dynamically bound handler block for the given type of condition.
This is a block method that ensures that the second block is executed either after the first or in any case if the original is aborted or control is otherwise handed elsewhere in the middle of execution without possibility of returning into that same execution.
Executes the block of code with a set of dynamically bound handler blocks, give as an Array of Associations between Condition objects and the handlers.
Returns from the condition with a value (default Nil), to the point where the condition was signalled.
Aborts from the condition, or aborts from it with a value, to the point where the handler was set up.
This is the condition method that is called if no other handlers are found for the context.

next up previous contents index
Next: 3.13 Concurrency Up: 3 The Slate World Previous: 3.11 Paths   Contents   Index
Brian Rice 2005-11-21