Exceptions
== Description ==
This page description the HOP machinery for raising and catching exceptions.
The constructions are available on the server //and// the client.
== Synopsis ==
=== Server & Client ===
(raise exception)
(error proc msg obj)
(with-handler handler body)
== Examples ==
with-handler, raise
== Definitions ==
=== ++(raise exception)++ ===
raise
^ arguments ^ type ^ short description ^
| exception | obj | the exception. |
This function //raises// an exception. That is, it escapes from the
current computation. If the raise call is executed in the dynamic extent
of a ++with-handler++ form, it executes the handler, otherwise, it
terminates the current thread.
=== ++(error proc msg obj)++ ===
error
^ arguments ^ type ^ short description ^
| proc | obj | a name. |
| msg | obj | a message. |
| obj | obj | a value. |
This procedure ++raise++s a freshly allocated exception denoting the error.
=== ++(with-handler handler body)++ ===
with-handler
^ arguments ^ type ^ short description ^
| handler | procedure | the exception handler. |
| body | | the protected body. |
The form ++with-handler++ evaluates its ++body++. If an exception is
++raise++d, the computation is suspended and the ++handler++ is executed in
the continuation of the ++with-handler++ form. I.e., if the ++handler++
is executed, the value is produces is the value of the whole
++with-handler++ form.
~~ The handler is a procedure of one argument. When the handler
is invoked, it argument is bound to the ++raise++d exception.