API for error-kit
- ()
by Chris Houser
Usage:
(ns your-namespace
(:require clojure.contrib.error-kit))
Overview
EXPERIMENTAL
System for defining and using custom errors
Please contact Chouser if you have any suggestions for better names
or API adjustments.
Public Variables and Functions
bind-continue
function
Usage: (bind-continue continue-name [args*] & body)
Special form to be used inside a 'with-handler'.
Control can be passed to this 'continue' form from a 'raise' enclosed
in this with-handler's dynamic scope, when this 'continue-name' is
given to a 'continue' form.
Source
deferror
macro
Usage: (deferror name [parent-error?] doc-string? [args*] & body)
(deferror name [parent-error?] doc-string? args-destruct-map & body)
Define a new error type
Source
do-not-handle
macro
Usage: (do-not-handle)
Use in a tail position of a 'handle' form to indicate 'raise' should
not consider the error handled, but should continue searching for an
appropriate 'handle' form. Allows finer-grain control over catching
than just the error type.
Source
error
function
Usage: (error details)
Base type for all error-kit errors
Source
handle
function
Usage: (handle error-name? [args*] & body)
(handle error-name? args-destruct-map-args & body)
Special form to be used inside a 'with-handler'. When
any error is 'raised' from withing the dynamic scope of 'body' that
is of error-name's type or a derived type, the args will be bound
and the body executed. If no 'error-name' is given, the body will
be executed for regardless of the type of error raised. The body
may return a value, in which case that will be the return value of
the entire 'with-handler' form, or it may use any of the special
return forms, 'do-not-handle', 'continue-with', or 'continue'.
Source
raise
macro
Usage: (raise err-name & args)
Raise an error of the type err-name, constructed with the given args
Source
raise*
function
Usage: (raise* err)
Raise the given error object, best if created by an error
constructor defined with deferror. See also 'raise' macro.
Source
throw-msg
macro
Usage: (throw-msg class-name)
Returns a function that throws a Java Exception with the given
name. Useful to associate a new error-kit error type with a
particular Java Exception class, via the :unhandled error key.
Source
with-handler
macro
Usage: (with-handler & forms)
This is error-kit's dynamic scope form. The body will be executed
in a dynamic context that includes all of the following 'handle' and
'bind-continue' forms.
Source