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.
(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
(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.
(with-op-aliases pairings)Given a map of op names to actions, add an entry for the deprecated,
unnamespaced alias of every cider/-namespaced op (pointing to the same
action). This is the dispatch-side mirror of
cider.nrepl/with-deprecated-aliases, so the handler answers exactly the same
legacy op names the descriptors advertise, without hand-duplicating each
pairing. Ops not starting with cider/ are passed through unchanged.
Given a map of op names to actions, add an entry for the deprecated, unnamespaced alias of every `cider/`-namespaced op (pointing to the same action). This is the dispatch-side mirror of `cider.nrepl/with-deprecated-aliases`, so the handler answers exactly the same legacy op names the descriptors advertise, without hand-duplicating each pairing. Ops not starting with `cider/` are passed through unchanged.
(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.
The op/action pairings can be given either as flat varargs (op action op action ...) or as a single map expression ({op action, ...}), the latter
being handy together with with-op-aliases.
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.
The op/action pairings can be given either as flat varargs (`op action op
action ...`) or as a single map expression (`{op action, ...}`), the latter
being handy together with `with-op-aliases`.cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |