Liking cljdoc? Tell your friends :D

farolero.core

Common Lisp style handlers and restarts for errors.

Common Lisp style handlers and restarts for errors.
raw docstring

*bound-blocks*clj/s

A set of blocks that the code is currently in the dynamic scope of.

A set of blocks that the code is currently in the dynamic scope of.
sourceraw docstring

*break-on-signals*clj/s

Dynamically-bound type of signal to break on. If this is non-nil, then any condition which matches it with [[isa?]] which is signaled will break. If it is true then this will occur for all conditions.

Dynamically-bound type of signal to [[break]] on.
If this is non-nil, then any condition which matches it with [[isa?]] which is
signaled will [[break]]. If it is `true` then this will occur for all
conditions.
sourceraw docstring

*debugger-arguments*clj

Dynamic variable with the args from the condition currently signaled in the debugger.

Dynamic variable with the args from the condition currently signaled in the debugger.
sourceraw docstring

*debugger-condition*clj

Dynamic variable with the condition currently signaled in the debugger.

Dynamic variable with the condition currently signaled in the debugger.
sourceraw docstring

*debugger-hook*clj/s

Dynamically-bound hook used in invoke-debugger. This is a function which takes two arguments, a list of the condition and arguments to it, and the currently bound debugger hook. This function must not return without a non-local exit.

Dynamically-bound hook used in [[invoke-debugger]].
This is a function which takes two arguments, a list of the condition and
arguments to it, and the currently bound debugger hook. This function must not
return without a non-local exit.
sourceraw docstring

*extra-values*clj/s

Dynamic variable for returning multiple values up the stack.

Dynamic variable for returning multiple values up the stack.
sourceraw docstring

*handlers*clj/s

Dynamically-bound list of handlers.

Dynamically-bound list of handlers.
sourceraw docstring

*in-tagbodies*clj/s

A set of tagbody blocks in the current dynamic scope.

A set of tagbody blocks in the current dynamic scope.
sourceraw docstring

*place*clj/s

The place being modified in an interactive continue from assert.

The place being modified in an interactive continue from [[assert]].
sourceraw docstring

*restarts*clj/s

Dynamically-bound list of restarts.

Dynamically-bound list of restarts.
sourceraw docstring

*system-debugger*clj/s

The debugger used when *debugger-hook* is nil. This happens when the error may have occurred in the debugger itself, or when break is called.

The debugger used when [[*debugger-hook*]] is nil.
This happens when the error may have occurred in the debugger itself, or
when [[break]] is called.
sourceraw docstring

*warning-printer*clj/s

Dynamically-bound function used to display a warning to the user.

This must be a varargs function taking a condition and additional arguments. The function report-condition may be used to assist in generating the error string.

The default value will write the condition to [[err]], including any stack trace on the condition if it is an exception type.

Dynamically-bound function used to display a warning to the user.

This must be a varargs function taking a `condition` and additional arguments.
The function [[report-condition]] may be used to assist in generating the
error string.

The default value will write the condition to [[*err*]], including any stack
trace on the condition if it is an exception type.
sourceraw docstring

abortclj/s

(abort)
(abort condition & args)

Aborts the current computation. Invokes the :farolero.core/abort restart.

Aborts the current computation.
Invokes the `:farolero.core/abort` restart.
sourceraw docstring

assertclj/smacro

(assert test)
(assert test places)
(assert test places condition & args)

Evaluates test and raises condition if it does not evaluate truthy. The restart :farolero.core/continue is bound when the condition is raised to retry the computation, and when invoked interactively prompts the user for new values for each of the provided places, during which :farolero.core/abort is bound to retry in the case of a failed assignment.

The interactive function is extensible by handling conditions of type :farolero.core/interactive-assertion with a single extra argument, a list of tuples of the values of the places and the forms that evaluate to them. During this a :farolero.core/continue restart is bound to skip requesting input from the user.

Evaluates `test` and raises `condition` if it does not evaluate truthy.
The restart `:farolero.core/continue` is bound when the condition is raised to
retry the computation, and when invoked interactively prompts the user for new
values for each of the provided `places`, during which `:farolero.core/abort`
is bound to retry in the case of a failed assignment.

The interactive function is extensible by handling conditions of type
`:farolero.core/interactive-assertion` with a single extra argument, a list of
tuples of the values of the `places` and the forms that evaluate to them.
During this a `:farolero.core/continue` restart is bound to skip requesting
input from the user.
sourceraw docstring

blockclj/smacro

(block block-name & body)

Constructs a named block which can be escaped by return-from.

Constructs a named block which can be escaped by [[return-from]].
sourceraw docstring

block*clj/s

(block* block-name f & more)

Calls f, so that it may be escaped by calling return-from, passing block-name. This is analogous to Common Lisp's catch operator, with return-from being passed a keyword directly replacing throw.

Calls `f`, so that it may be escaped by calling [[return-from]], passing `block-name`.
This is analogous to Common Lisp's `catch` operator, with [[return-from]]
being passed a keyword directly replacing `throw`.
sourceraw docstring

breakclj/s

(break condition & args)

Binds the system debugger and invokes it on the given condition. Binds the restart :farolero.core/continue during debugging which will exit the debugger normally.

Binds the system debugger and invokes it on the given `condition`.
Binds the restart `:farolero.core/continue` during debugging which will exit
the debugger normally.
sourceraw docstring

cerrorclj/s

(cerror)
(cerror report-fmt)
(cerror report-fmt condition & args)

Signals a condition as error, but binds a restart to continue. The :farolero.core/continue restart is bound for any handlers invoked by this error. This restart may be invoked directly by calling continue.

The report-fmt is used as the argument to :report in the resulting restart.

See signal.

Signals a condition as [[error]], but binds a restart to continue.
The `:farolero.core/continue` restart is bound for any handlers invoked by
this error. This restart may be invoked directly by calling [[continue]].

The `report-fmt` is used as the argument to `:report` in the resulting
restart.

See [[signal]].
sourceraw docstring

check-typeclj/smacro

(check-type place spec)
(check-type place spec type-description)

Checks to see if the value stored in place conforms to spec. place must evaluate to an implementation of IDeref. Raises a :farolero.core/type-error if it does not conform. Binds a :farolero.core/store-value restart taking a function to modify place and a value to use as its second argument. Also binds :farolero.core/continue to retry check.

If the :farolero.core/store-value restart is invoked interactively, it will signal :farolero.core/interactive-check-type, passing the form for place, binding a further :farolero.core/store-value restart which expects the modify function and argument for passing to the outer restart.

Checks to see if the value stored in `place` conforms to `spec`.
`place` must evaluate to an implementation of IDeref. Raises a
`:farolero.core/type-error` if it does not conform. Binds a
`:farolero.core/store-value` restart taking a function to modify `place` and a
value to use as its second argument. Also binds `:farolero.core/continue` to
retry check.

If the `:farolero.core/store-value` restart is invoked interactively, it will
signal `:farolero.core/interactive-check-type`, passing the form for `place`,
binding a further `:farolero.core/store-value` restart which expects the
modify function and argument for passing to the outer restart.
sourceraw docstring

compute-restartsclj/s

(compute-restarts)
(compute-restarts condition & args)

Returns a sequence of all usable restarts. Any restart with a :farolero.core/restart-test function will be filtered based on if it returns a truthy value when called with condition and args.

Returns a sequence of all usable restarts.
Any restart with a `:farolero.core/restart-test` function will be filtered
based on if it returns a truthy value when called with `condition` and
`args`.
sourceraw docstring

continueclj/s

(continue)
(continue condition & args)

Ignores the signaled condition and continues. Invokes the :farolero.core/continue restart. If the restart isn't present, returns nil.

See cerror.

Ignores the signaled condition and continues.
Invokes the `:farolero.core/continue` restart.
If the restart isn't present, returns nil.

See [[cerror]].
sourceraw docstring

debugger-threadclj

The current thread that the debugger is active on, if any.

The current thread that the debugger is active on, if any.
sourceraw docstring

debugger-wait-queueclj

A map of threads to the condition they are waiting on.

A map of threads to the condition they are waiting on.
sourceraw docstring

errorclj/s

(error condition & args)

Signals a condition, calling invoke-debugger if any handlers return normally.

See signal.

Signals a condition, calling [[invoke-debugger]] if any handlers return normally.

See [[signal]].
sourceraw docstring

find-restartclj/s

(find-restart restart-name)
(find-restart restart-name condition & args)

Returns the first restart bound named by restart-name.

Returns the first restart bound named by `restart-name`.
sourceraw docstring

flow?clj

source

goclj/s

(go tag)

Jumps to the given tag in the surrounding tagbody.

Jumps to the given `tag` in the surrounding [[tagbody]].
sourceraw docstring

handler-bindclj/smacro

(handler-bind [bindings*] exprs*)

Runs the body with bound signal handlers to recover from errors. Each binding clause is one of the following forms: condition-type handler-fn condition-type [handler-fn & {:keys [thread-local]}]

The condition-type must be a namespaced keyword, or a class name for the object used as the condition. This is tested with [[isa?]], permitting the use of Clojure hierarchies. Both the object and the [[type]] of it are checked against the condition-type.

The handler-fn is a function of at least one argument. The first argument is the condition which was signaled, additional arguments are passed from the rest arguments used when signaling.

The thread-local configuration for a handler specifies whether or not other threads are allowed to invoke this handler. It defaults to false. If the handler performs any kind of non-local return, such as calling a restart that performs non-local return, signaling an error that might be handled with a non-local return, or calling to return-from or go, it should be set to true.

If the handler returns normally, then additional handlers which apply to the condition type are run moving up the stack, ignoring other handlers bound in this call, until no more are left. If all applicable handlers return normally, then control is returned to the signaling function.

Runs the `body` with bound signal handlers to recover from errors.
Each binding clause is one of the following forms:
condition-type handler-fn
condition-type [handler-fn & {:keys [thread-local]}]

The condition-type must be a namespaced keyword, or a class name for the
object used as the condition. This is tested with [[isa?]], permitting the use
of Clojure hierarchies. Both the object and the [[type]] of it are checked
against the condition-type.

The handler-fn is a function of at least one argument. The first argument is
the condition which was signaled, additional arguments are passed from the
rest arguments used when signaling.

The thread-local configuration for a handler specifies whether or not other
threads are allowed to invoke this handler. It defaults to false. If the
handler performs any kind of non-local return, such as calling a restart that
performs non-local return, signaling an error that might be handled with a
non-local return, or calling to [[return-from]] or [[go]], it should be set to
true.

If the handler returns normally, then additional handlers which apply to the
condition type are run moving up the stack, ignoring other handlers bound in
this call, until no more are left. If all applicable handlers return normally,
then control is returned to the signaling function.
sourceraw docstring

handler-caseclj/smacro

(handler-case expr bindings*)

Runs the expr with signal handlers bound, returning the value from the handler on signal. Bindings are of the following form: (condition-type [condition-sym & args] & body) (:no-error [condition-sym & args] & body)

The condition-type may be a namespaced keyword or class name. The argument vector must have one symbol to be the condition-sym, and potentially more arguments based on what it is expected to be signaled with.

If a condition handled by one of the binding clauses is signaled, the stack is immediately unwound out of the context of expr, and then the handler is run, with its return value used as a replacement for the return value of the entire expr.

An additional clause which can be present is :no-error, which takes arguments for the return values of the expression (multiple may be provided with values), and is only run when no condition handled by this call is signaled.

See handler-bind.

Runs the `expr` with signal handlers bound, returning the value from the handler on signal.
Bindings are of the following form:
(condition-type [condition-sym & args] & body)
(:no-error [condition-sym & args] & body)

The condition-type may be a namespaced keyword or class name. The argument
vector must have one symbol to be the condition-sym, and potentially more
arguments based on what it is expected to be signaled with.

If a condition handled by one of the binding clauses is signaled, the stack is
immediately unwound out of the context of `expr`, and then the handler is run,
with its return value used as a replacement for the return value of the entire
`expr`.

An additional clause which can be present is `:no-error`, which takes
arguments for the return values of the expression (multiple may be provided
with [[values]]), and is only run when no condition handled by this call is
signaled.

See [[handler-bind]].
sourceraw docstring

ignore-errorsclj/smacro

(ignore-errors & body)

Evaluates the body, returning nil if any errors are signaled. Any arguments passed to the restart are returned as additional values.

Evaluates the `body`, returning nil if any errors are signaled.
Any arguments passed to the restart are returned as additional [[values]].
sourceraw docstring

invoke-debuggerclj/s

(invoke-debugger condition & args)

Calls the *debugger-hook*, or *system-debugger* if not bound, with the condition.

Calls the [[*debugger-hook*]], or [[*system-debugger*]] if not bound, with the `condition`.
sourceraw docstring

invoke-restartclj/s

(invoke-restart restart-name & args)

Calls a restart by the given name with args. If the restart isn't found, signals a :farolero.core/control-error.

Throws an assertion exception if called outside a restart context.

See restart-bind, restart-case.

Calls a restart by the given name with `args`.
If the restart isn't found, signals a `:farolero.core/control-error`.

Throws an assertion exception if called outside a restart context.

See [[restart-bind]], [[restart-case]].
sourceraw docstring

invoke-restart-interactivelyclj/s

(invoke-restart-interactively restart-name)

Calls a restart by the given name interactively. If the restart was created with an :interactive-function, then it is called to produce the argument list for the restart. Otherwise, a default is used. In Clojure, the default is to read and evaluate from [[in]]. In ClojureScript, the default is to produce nil as the arguments.

See invoke-restart

Calls a restart by the given name interactively.
If the restart was created with an `:interactive-function`, then it is called
to produce the argument list for the restart. Otherwise, a default is used. In
Clojure, the default is to read and evaluate from [[*in*]]. In ClojureScript,
the default is to produce nil as the arguments.

See [[invoke-restart]]
sourceraw docstring

jump-factoryclj/s

(jump-factory block target)

INTERNAL: Constructs a function body which throws to the passed target.

INTERNAL: Constructs a function body which throws to the passed `target`.
sourceraw docstring

make-jump-targetclj/s

(make-jump-target)

INTERNAL: Constructs a new object to be used as the target of a jump.

INTERNAL: Constructs a new object to be used as the target of a jump.
sourceraw docstring

muffle-warningclj/s

(muffle-warning)
(muffle-warning condition & args)

Ignores the warning and continues. Invokes the :farolero.core/muffle-warning restart.

See warn.

Ignores the warning and continues.
Invokes the `:farolero.core/muffle-warning` restart.

See [[warn]].
sourceraw docstring

multiple-value-bindclj/smacro

(multiple-value-bind [binding expr] & body)

Binds multiple return values. Additional return values can be provided by values.

Binds multiple return values.
Additional return values can be provided by [[values]].
sourceraw docstring

multiple-value-callclj/smacro

(multiple-value-call f & forms)

Calls f with all the values returned by each of the forms.

Calls `f` with all the values returned by each of the `forms`.
sourceraw docstring

multiple-value-listclj/smacro

(multiple-value-list expr)

Returns the multiple values from expr as a list.

Returns the multiple values from `expr` as a list.
sourceraw docstring

report-conditionclj/smultimethod

Multimethod for creating a human-readable explanation of a condition. Takes a condition and args and returns a string describing them.

The dispatch value is a condition-type as in handler-bind.

Multimethod for creating a human-readable explanation of a condition.
Takes a `condition` and `args` and returns a string describing them.

The dispatch value is a condition-type as in [[handler-bind]].
sourceraw docstring

report-control-errorclj/smultimethod

Multimethod for creating a human-readable explanation of a control error. Dispatches on the :type key of the error.

Multimethod for creating a human-readable explanation of a control error.
Dispatches on the `:type` key of the error.
sourceraw docstring

report-restartclj/s

(report-restart {:as restart
                 :farolero.core/keys [restart-name restart-reporter]})

Reports the restart using the its report-function.

Reports the restart using the its report-function.
sourceraw docstring

request-interactionclj/s≠

clj
(request-interaction condition)
(request-interaction prompt)
(request-interaction condition prompt)
cljs
(request-interaction condition-or-prompt)
(request-interaction condition prompt)

Requests the user perform some interaction before the program continues.

Signals condition with a :farolero.core/continue restart bound to continue execution. If the signal is not handled, prompt is printed to [[out]] and a repl prompt is printed, along with instruction to call [[complete]] when the user is done interacting with the system.

The first argument to the condition will be the prompt.

If condition is [[sequential?]] then the first element is signaled as a condition with the rest as further arguments after the prompt. If you wish to signal a [[sequential?]] argument, you must wrap it in an additional sequence.

If the condition which gets signaled does not already [[derive]] from :farolero.core/request-interaction, it will be made to do so.

See request-value.

Requests the user perform some interaction before the program continues.

Signals `condition` with a `:farolero.core/continue` restart bound to continue
execution. If the signal is not handled, `prompt` is printed to [[*out*]] and
a repl prompt is printed, along with instruction to call [[complete]] when the
user is done interacting with the system.

The first argument to the condition will be the `prompt`.

If `condition` is [[sequential?]] then the first element is signaled as a
condition with the rest as further arguments after the `prompt`. If you wish
to signal a [[sequential?]] argument, you must wrap it in an additional
sequence.

If the `condition` which gets signaled does not already [[derive]] from
`:farolero.core/request-interaction`, it will be made to do so.

See [[request-value]].
sourceraw docstring

request-valueclj/s≠

clj
(request-value condition)
(request-value prompt)
(request-value condition prompt)
(request-value prompt valid?)
(request-value condition prompt valid?)
cljs
(request-value condition-or-prompt)
(request-value condition-or-prompt prompt-or-valid?)
(request-value condition prompt valid?)

Request a value from the user interactively.

Signals condition with a :farolero.core/use-value restart bound to return the passed value. If the signal is not handled, prompt is printed to [[out]] and a repl prompt is printed. The user can enter an expression that evaluates to the value to use.

The first argument to the condition with be prompt, followed by valid?. If no function valid? is provided, [[any?]] is passed instead.

If condition is [[sequential?]] then the first element is signaled as a condition with the rest as additional arguments after prompt and valid?. If you wish to signal a [[sequential?]] argument, you must wrap it in an additional sequence.

If the condition which gets signaled does not already [[derive]] from :farolero.core/request-value, it will be made to do so.

See request-interaction.

Request a value from the user interactively.

Signals `condition` with a `:farolero.core/use-value` restart bound to return
the passed value. If the signal is not handled, `prompt` is printed
to [[*out*]] and a repl prompt is printed. The user can enter an expression
that evaluates to the value to use.

The first argument to the condition with be `prompt`, followed by `valid?`. If
no function `valid?` is provided, [[any?]] is passed instead.

If `condition` is [[sequential?]] then the first element is signaled as a
condition with the rest as additional arguments after `prompt` and `valid?`.
If you wish to signal a [[sequential?]] argument, you must wrap it in an
additional sequence.

If the `condition` which gets signaled does not already [[derive]] from
`:farolero.core/request-value`, it will be made to do so.

See [[request-interaction]].
sourceraw docstring

restart-bindclj/smacro

(restart-bind [bindings*] exprs*)

Runs the body with bound restarts. Within the dynamic scope of the body, invoke-restart may be called with any of the bound restart names. This includes inside handlers bound further up the stack.

Each binding clause is one of the following forms: restart-name restart-fn restart-name [restart-fn & {:keys [test-function interactive-function report-function thread-local]}]

The restart-name is a namespaced keyword.

The restart-fn is a function of zero or more arguments, provided by rest arguments on the call to invoke-restart. The function returns normally.

The test-function is a function of an optional condition and its additional arguments. If it returns a truthy value, the restart is available, otherwise it cannot be invoked from its context. If not provided, the restart is assumed to be available.

The report-function is a function or string used to display this condition to the user. If it is a function, it is called with the restart as an argument and should return a string. The restart will be a map with the key :farolero.core/restart-name. If report-function is a string, it is used verbatim.

The boolean thread-local tells the system whether or not this restart may be invoked from other threads. It defaults to false. If the restart performs any kind of non-local return that cares about which thread performs it, such as a call to return-from or go, signaling a condition which may cause a non-local return, or invoking a restart which may perform a non-local return, it should set it to true.

The interactive-function is a function of no arguments that is called to get input from the user interactively. It returns a list, used as the argument list to restart-fn.

Runs the `body` with bound restarts.
Within the dynamic scope of the `body`, [[invoke-restart]] may be called with
any of the bound restart names. This includes inside handlers bound further up
the stack.

Each binding clause is one of the following forms:
restart-name restart-fn
restart-name [restart-fn & {:keys [test-function interactive-function report-function thread-local]}]

The restart-name is a namespaced keyword.

The restart-fn is a function of zero or more arguments, provided by rest
arguments on the call to [[invoke-restart]]. The function returns normally.

The test-function is a function of an optional condition and its additional
arguments. If it returns a truthy value, the restart is available, otherwise
it cannot be invoked from its context. If not provided, the restart is assumed
to be available.

The report-function is a function or string used to display this condition to
the user. If it is a function, it is called with the restart as an argument
and should return a string. The restart will be a map with the key
`:farolero.core/restart-name`. If report-function is a string, it is used
verbatim.

The boolean thread-local tells the system whether or not this restart may be
invoked from other threads. It defaults to false. If the restart performs any
kind of non-local return that cares about which thread performs it, such as a
call to [[return-from]] or [[go]], signaling a condition which may cause a
non-local return, or invoking a restart which may perform a non-local return,
it should set it to true.

The interactive-function is a function of no arguments that is called to get
input from the user interactively. It returns a list, used as the argument
list to restart-fn.
sourceraw docstring

restart-caseclj/smacro

(restart-case expr bindings*)

Runs the expr with bound restarts, returning a value from the restart on invoke. Bindings are of the following form: (restart-name [& args] config* & body)

The restart-name is a keyword or nil and is used to find-restart. The argument vector will take any arguments passed to the restart via invoke-restart.

The config is a sequence of keyword-value pairs for the config options :test, :report, and :interactive, each of which corresponds to a config option in restart-bind.

If one of the restarts bound in this case is invoked then the stack is immediately unwound to outside of expr, and then the restart is run, with its return value used as a replacement for the return value of expr.

Runs the `expr` with bound restarts, returning a value from the restart on invoke.
Bindings are of the following form:
(restart-name [& args] config* & body)

The restart-name is a keyword or `nil` and is used to [[find-restart]]. The
argument vector will take any arguments passed to the restart
via [[invoke-restart]].

The config is a sequence of keyword-value pairs for the config options
`:test`, `:report`, and `:interactive`, each of which corresponds to a config
option in [[restart-bind]].

If one of the restarts bound in this case is invoked then the stack is
immediately unwound to outside of `expr`, and then the restart is run, with
its return value used as a replacement for the return value of `expr`.
sourceraw docstring

return-fromclj/s

(return-from block-name)
(return-from block-name value)

Performs an early return from a named block.

Performs an early return from a named [[block]].
sourceraw docstring

signalclj/s

(signal condition & args)

Signals a condition, triggering handlers bound for the condition type. Looks up the stack for handlers which apply to the given condition and then applies them in sequence until they all complete or one calls invoke-restart. If this function returns normally, it will return nil.

Signals a `condition`, triggering handlers bound for the condition type.
Looks up the stack for handlers which apply to the given `condition` and then
applies them in sequence until they all complete or one calls
[[invoke-restart]]. If this function returns normally, it will return nil.
sourceraw docstring

store-valueclj/s

(store-value val)
(store-value val condition & args)

Stores the val in a way determined by the restart. Invokes the :farolero.core/store-value restart. If the restart isn't present, returns nil.

See store-value-fn.

Stores the `val` in a way determined by the restart.
Invokes the `:farolero.core/store-value` restart.
If the restart isn't present, returns nil.

See [[store-value-fn]].
sourceraw docstring

store-value-fnclj/s

(store-value-fn store-fn val)
(store-value-fn store-fn val condition & args)

Stores the val using store-fn. Invokes the :farolero.core/store-value restart. store-fn is used as a method to store values in the place. This may be used to provide [[clojure.core/swap!]], [[clojure.core/vswap!]], or other methods of storing values in a mutable storage.

See store-value.

Stores the `val` using `store-fn`.
Invokes the `:farolero.core/store-value` restart.
`store-fn` is used as a method to store values in the place. This may be used
to provide [[clojure.core/swap!]], [[clojure.core/vswap!]], or other methods
of storing values in a mutable storage.

See [[store-value]].
sourceraw docstring

system-debuggerclj

(system-debugger [condition & args] _)

Recursive debugger used as the default. Binds [[debugger-level]], *debugger-condition*, and *debugger-arguments* inside the debugger.

Reports the restarts available for the given condition, and provides a repl to evaluate arbitrary values to prepare for invoking them. Entering a number at the repl will invoke the corresponding restart interactively.

If another error is signaled without being handled, an additional layer of the debugger is invoked.

Recursive debugger used as the default.
Binds [[*debugger-level*]], [[*debugger-condition*]], and
[[*debugger-arguments*]] inside the debugger.

Reports the restarts available for the given condition, and provides a repl to
evaluate arbitrary values to prepare for invoking them. Entering a number at
the repl will invoke the corresponding restart interactively.

If another error is signaled without being handled, an additional layer of
the debugger is invoked.
sourceraw docstring

tagbodyclj/smacro

(tagbody & clauses)

Performs the clauses in order, returning nil, allowing go between clauses. Each clause is in the following form: tag forms*

The tag is a symbol naming the clause. Optionally any number of forms may be placed before the first tag, and these will execute first, although there is no way to jump to them after their execution.

Performs the clauses in order, returning nil, allowing [[go]] between clauses.
Each clause is in the following form:
tag forms*

The tag is a symbol naming the clause. Optionally any number of forms may be
placed before the first tag, and these will execute first, although there is
no way to jump to them after their execution.
sourceraw docstring

throwing-debuggerclj/s

(throwing-debugger [condition & args] _)

A "debugger" that wraps conditions with [[ex-info]] and throws them. If the condition is an [[Exception]] and no further arguments are included, then the condition is thrown directly instead.

A "debugger" that wraps conditions with [[ex-info]] and throws them.
If the `condition` is an [[Exception]] and no further arguments are included,
then the `condition` is thrown directly instead.
sourceraw docstring

use-valueclj/s

(use-value val)
(use-value val condition & args)

Uses val instead of the value which caused the error. Invokes the :farolero.core/use-value restart. If the restart isn't present, returns nil.

Uses `val` instead of the value which caused the error.
Invokes the `:farolero.core/use-value` restart.
If the restart isn't present, returns nil.
sourceraw docstring

valuesclj/smacro

(values value & more)

Returns multiple values. The first value is the "true" return value. Additional values may be bound using multiple-value-bind.

Because of limitations on which values can hold metadata, the additional values are not actually associated with the primary return value, and are instead held in *extra-values*. This means if a multiple-value-bind or other methods of getting the extra values is done on a call which does not return multiple values, it may "leak" multiple values which were returned by some call within its dynamic extent but whose value was not returned.

Returns multiple values.
The first value is the "true" return value. Additional values may be bound
using [[multiple-value-bind]].

Because of limitations on which values can hold metadata, the additional
values are not actually associated with the primary return value, and are
instead held in [[*extra-values*]]. This means if a [[multiple-value-bind]] or
other methods of getting the extra values is done on a call which does not
return multiple values, it may "leak" multiple values which were returned by
some call within its dynamic extent but whose value was not returned.
sourceraw docstring

values-listclj/s

(values-list values)

Returns the input list as multiple values.

Returns the input list as multiple values.
sourceraw docstring

warnclj/s

(warn condition & args)

Signals a condition, reporting a warning if not handled. Returns nil. Reports the warning using *warning-printer*.

Binds a restart called :farolero.core/muffle-warning, which prevents the warning without any additional side effects. This restart may be invoked directly by calling muffle-warning.

The condition will be modified to derive from :farolero.core/warning. If it is a keyword, it will derive directly, otherwise it will derive the [[type]].

See signal.

Signals a condition, reporting a warning if not handled.
Returns nil. Reports the warning using [[*warning-printer*]].

Binds a restart called `:farolero.core/muffle-warning`, which prevents the
warning without any additional side effects. This restart may be invoked
directly by calling [[muffle-warning]].

The `condition` will be modified to derive from `:farolero.core/warning`. If
it is a keyword, it will derive directly, otherwise it will derive
the [[type]].

See [[signal]].
sourceraw docstring

with-simple-restartclj/smacro

(with-simple-restart [restart-name format-str & args] & body)

Constructs a restart with the given name which unwinds and returns nil. Returns true as a second value with values when the restart was triggered.

The format-str and args are used when reporting the restart.

Constructs a restart with the given name which unwinds and returns nil.
Returns true as a second value with [[values]] when the restart was
triggered.

The `format-str` and `args` are used when reporting the restart.
sourceraw docstring

without-handlersclj/smacro

(without-handlers & body)

Runs the body in a context where no handlers are bound. Use with caution. It's incredibly rare that handlers should be completely unbound when running a given bit of code.

The main intended usecase for this is to allow spinning up additional threads without the bound handlers being used. Even in this context however, most of the handlers which are undesirable to be run from alternate threads will be marked as thread-local. If the only reason to unbind handlers is to prevent calling a handler which may attempt to perform a non-local return, then this macro should not be used.

See without-restarts.

Runs the `body` in a context where no handlers are bound.
Use with caution. It's incredibly rare that handlers should be completely
unbound when running a given bit of code.

The main intended usecase for this is to allow spinning up additional threads
without the bound handlers being used. Even in this context however, most of
the handlers which are undesirable to be run from alternate threads will be
marked as thread-local. If the only reason to unbind handlers is to prevent
calling a handler which may attempt to perform a non-local return, then this
macro should not be used.

See [[without-restarts]].
sourceraw docstring

without-restartsclj/smacro

(without-restarts & body)

Runs the body in a context where no restarts are bound. Use with caution. It's incredibly rare that restarts should be completely unbound when running a given bit of code.

Most restarts that will be called will perform some kind of non-local return. In those circumstances, the restarts will already not be visible to threads other than the one that bound them. This means that the cases in which this macro are necessary are incredibly rare, and should be carefully considered.

See without-handlers.

Runs the `body` in a context where no restarts are bound.
Use with caution. It's incredibly rare that restarts should be completely
unbound when running a given bit of code.

Most restarts that will be called will perform some kind of non-local return.
In those circumstances, the restarts will already not be visible to threads
other than the one that bound them. This means that the cases in which this
macro are necessary are incredibly rare, and should be carefully considered.

See [[without-handlers]].
sourceraw docstring

wrap-exceptionsclj/smacro

(wrap-exceptions & body)

Catches all exceptions from evaluating body and signals them as errors. This only catches [[Exception]]s, meaning block, tagbody, conditions, and restarts can all be handled through the dynamic scope of body without issue.

If an exception is signaled as a condition, then two restarts will be bound. The restart :farolero.core/continue is bound and will retry the code which threw the exception and may be used if a simple retry may fix the error, or in cases where the handler can perform some work that will ensure the operation succeeds. The restart :farolero.core/use-value takes one argument and will return it without modification as a replacement for the value returned by the macro call.

If the :farolero.core/use-value restart is invoked interactively it will signal :farolero.core/interactive-wrap-exceptions with the exception as an argument, with an additional :farolero.core/use-value restart bound to provide the value to use for the outer restart.

Catches all exceptions from evaluating `body` and signals them as [[error]]s.
This only catches [[Exception]]s, meaning [[block]], [[tagbody]], conditions,
and restarts can all be handled through the dynamic scope of `body` without
issue.

If an exception is signaled as a condition, then two restarts will be bound.
The restart `:farolero.core/continue` is bound and will retry the code which
threw the exception and may be used if a simple retry may fix the error, or in
cases where the handler can perform some work that will ensure the operation
succeeds. The restart `:farolero.core/use-value` takes one argument and will
return it without modification as a replacement for the value returned by the
macro call.

If the `:farolero.core/use-value` restart is invoked interactively it will
signal `:farolero.core/interactive-wrap-exceptions` with the exception as an
argument, with an additional `:farolero.core/use-value` restart bound to
provide the value to use for the outer restart.
sourceraw docstring

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close