Liking cljdoc? Tell your friends :D

cider.nrepl.middleware.util.error-handling

Utilities to safely reply to op requests and help deal with the errors/exceptions that might arise from doing so.

Utilities to safely reply to op requests and help deal with the
errors/exceptions that might arise from doing so.
raw docstring

base-error-responseclj

(base-error-response msg ex & statuses)

Takes a CIDER-nREPL message as msg, an Exception ex, and a non-collection vararg of statuses. This will return the standard response for CIDER-nREPL sync-op errors that can be rendered by CIDER's stacktrace viewer. N.B., statuses such as :done and :<op-name>-error are NOT automatically added

Takes a CIDER-nREPL message as `msg`, an Exception `ex`, and a
non-collection vararg of `statuses`.  This will return the standard
response for CIDER-nREPL sync-op errors that can be rendered by
CIDER's stacktrace viewer. N.B., statuses such as `:done` and
`:<op-name>-error` are NOT automatically added
sourceraw docstring

error-handlercljmultimethod

source

error-summaryclj

(error-summary ex & statuses)

Takes a java.lang.Exception as ex and returns a map summarizing the exception. If present, the varargs are converted to a set and used as the value for the :status key.

Takes a `java.lang.Exception` as `ex` and returns a map summarizing
the exception. If present, the varargs are converted to a set and
used as the value for the :status key.
sourceraw docstring

eval-interceptor-transportclj

(eval-interceptor-transport {:keys [transport] :as msg}
                            reply-fn
                            &
                            error-statuses)

Return a transport that wraps the transport in msg and intercepts the :value coming out of it as well as any raised exceptions. Exceptions are propagated as errors in the inspector middleware (specified by error-statuses), so that the client CIDER code properly renders them instead of silently ignoring. reply-fn is invoked on the message and the :value when it arrives.

Return a transport that wraps the transport in `msg` and intercepts the
`:value` coming out of it as well as any raised exceptions. Exceptions are
propagated as errors in the inspector middleware (specified by
`error-statuses`), so that the client CIDER code properly renders them instead
of silently ignoring. `reply-fn` is invoked on the message and the `:value`
when it arrives.
sourceraw docstring

op-handlercljmultimethod

source

pp-stacktraceclj

(pp-stacktrace ex print-fn)

Takes a java.lang.Exception as ex and a pretty-print function as print-fn, then returns a pretty-printed version of the exception that can be rendered by CIDER's stacktrace viewer.

Takes a `java.lang.Exception` as `ex` and a pretty-print function
as `print-fn`, then returns a pretty-printed version of the
exception that can be rendered by CIDER's stacktrace viewer.
sourceraw docstring

with-safe-transportcljmacro

(with-safe-transport handler msg & pairings)

This will safely handle all the transport calls mapped out in the handle-<middleware> functions. All checked exceptions will be caught, analyzed by the cider.nrepl.middleware.stacktrace middleware, and an error message will be returned to the client with a stacktrace renderable by the default CIDER stacktrace viewer. Takes the default pass-through handler current msg and a list of pairings between op names and actions used to process the ops as varargs. Actions can either be expressed as a 2-item vector with the head being the op-action and the tail being the error-action, or if the default error handler is sufficient, then the op name can be paired directly to the op-action.

Actions can be functions, maps, non-associate collections, and single items such as kw's, strings, numbers, etc. The utilization of each type is discussed above in the selector method.

This will safely handle all the transport calls mapped out in the
`handle-<middleware>` functions. All checked exceptions will be caught,
analyzed by the `cider.nrepl.middleware.stacktrace` middleware, and an error
message will be returned to the client with a stacktrace renderable by the
default CIDER stacktrace viewer. Takes the default pass-through `handler`
current `msg` and a list of pairings between op names and actions used to
process the ops as varargs. Actions can either be expressed as a 2-item vector
with the head being the op-action and the tail being the error-action, or if
the default error handler is sufficient, then the op name can be paired
directly to the op-action.

Actions can be functions, maps, non-associate collections, and single items
such as kw's, strings, numbers, etc. The utilization of each type is discussed
above in the `selector` method.
sourceraw docstring

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

× close