(after-enter-update-context {queue :a-frame.interceptor-chain/queue
stack :a-frame.interceptor-chain/stack
_history :a-frame.interceptor-chain/history
:as context}
_interceptor-fn-key
interceptor-spec
history-entry)
update a context after the enter fn has been processed
update a context after the enter fn has been processed
(after-leave-update-context {stack :a-frame.interceptor-chain/stack
_history :a-frame.interceptor-chain/history
_error :a-frame.interceptor-chain/error
:as context}
interceptor-fn-key
has-thunk?
_interceptor-spec
history-entry)
update a context after a leave fn has been processed
update a context after a leave fn has been processed
(assoc-opaque-keys ctx app-ctx a-frame-router)
add the opaque keys to the interceptor context
they are removed from reported contexts by sanitise-context
add the opaque keys to the interceptor context they are removed from reported contexts by `sanitise-context`
(clear-error context)
Removes any associated ::error
from context
Removes any associated `::error` from `context`
The Interceptor specific keys that are added to contexts
The Interceptor specific keys that are added to contexts
(dissoc-context-keys context)
Removes all interceptor related keys from context
Removes all interceptor related keys from `context`
(enqueue context interceptors)
Adds interceptors
to the end of the interceptor queue within context
Adds `interceptors` to the end of the interceptor queue within `context`
(enter-all context)
Process the :queue
of context
, calling each :enter
fn
in turn.
If an error is raised it is captured, stored in the context
s :error
key,
and the queue is cleared (to prevent further processing.)
Process the `:queue` of `context`, calling each `:enter` `fn` in turn. If an error is raised it is captured, stored in the `context`s `:error` key, and the queue is cleared (to prevent further processing.)
(enter-next {queue :a-frame.interceptor-chain/queue
_stack :a-frame.interceptor-chain/stack
_history :a-frame.interceptor-chain/history
:as context})
Executes the next ::enter
interceptor queued within context
, returning a
promise that will resolve to the next pr-loop-context
action to take
TODO errors in [[resolve-data]] are not handled properly
Executes the next `::enter` interceptor queued within `context`, returning a promise that will resolve to the next [[pr-loop-context]] action to take TODO errors in [[resolve-data]] are not handled properly
(execute app-ctx a-frame-router interceptor-chain initial-context)
Returns a Promise encapsulating the execution of the given [[InterceptorContext]].
Runs all :enter
interceptor fns (in FIFO order) and then all :leave
fns
(in LIFO order) returning the end result context
map.
If an error occurs during execution :enter
processing is terminated and the
:error
handlers of all executed interceptors are called (in LIFO order),
with the original error wrapped in an ex-info with ex-data containing the
at the point of failure in the ::resume key - this can be used to resume processing
from the failure point
If the resulting context
still contains an error after this processing it
will be re-thrown when the execution promise is realised.
Returns a Promise encapsulating the execution of the given [[InterceptorContext]]. Runs all `:enter` interceptor fns (in FIFO order) and then all `:leave` fns (in LIFO order) returning the end result `context` map. If an error occurs during execution `:enter` processing is terminated and the `:error` handlers of all executed interceptors are called (in LIFO order), with the original error wrapped in an ex-info with ex-data containing the at the point of failure in the ::resume key - this can be used to resume processing from the failure point If the resulting `context` _still_ contains an error after this processing it will be re-thrown when the execution promise is realised.
(final-error-handler {err :a-frame.interceptor-chain/error :as ctx})
if there is still an error after processing, throw it
if there is still an error after processing, throw it
(initiate app-ctx a-frame-router interceptor-chain initial-context)
Given a sequence of [[InterceptorSpec]]s and a map of initial-context
values,
returns a new [[InterceptorContext]] ready to execute
Given a sequence of [[InterceptorSpec]]s and a map of `initial-context` values, returns a new [[InterceptorContext]] ready to [[execute]]
(interceptor-fn-history-thunk interceptor-fn-key interceptor-spec context error)
returns a [<history-entry> <interceptor-fn-thunk>]
<history-entry> :- [<interceptor-spec> <interceptor-fn-key> <operation> :- ::execute | ::noop <data> <outcome> :- ::success | ::error]
the <data> and <outcome> fields in the <history-entry> tuple will be added later. the <interceptor-fn-thunk> returns [<data> <next-context>] when it completes normally
returns a [<history-entry> <interceptor-fn-thunk>] <history-entry> :- [<interceptor-spec> <interceptor-fn-key> <operation> :- ::execute | ::noop <data> <outcome> :- ::success | ::error] the <data> and <outcome> fields in the <history-entry> tuple will be added later. the <interceptor-fn-thunk> returns [<data> <next-context>] when it completes normally
(interceptor-fn-requires-data? interceptor-fn-key interceptor-spec)
(leave-all context)
Process the ::stack
of context
, calling, in LIFO order.
If an ::error
is present in the context
then the ::error
handling fn
of the interceptors will be called otherwise the :leave
fn
s will be
called.
Any thrown errors will replace the current ::error
with stack unwinding
continuing from that point forwards.
Process the `::stack` of `context`, calling, in LIFO order. If an `::error` is present in the `context` then the `::error` handling `fn` of the interceptors will be called otherwise the `:leave` `fn`s will be called. Any thrown errors will replace the current `::error` with stack unwinding continuing from that point forwards.
(leave-next {stack :a-frame.interceptor-chain/stack
_history :a-frame.interceptor-chain/history
error :a-frame.interceptor-chain/error
:as context})
Executes the next ::leave
or ::error
interceptor on the stack within
context
, returning a promise that will resolve to the next
pr-loop-context
action to take
Executes the next `::leave` or `::error` interceptor on the stack within `context`, returning a promise that will resolve to the next [[pr-loop-context]] action to take
(maybe-execute-interceptor-fn interceptor-fn-key interceptor-spec context error)
call an interceptor fn on an interceptor, resolving any supplied data
call an interceptor fn on an interceptor, resolving any supplied data
(normalize-interceptor-spec interceptor-spec)
turns keyword interceptor-specs into maps {::key <interceptor-key>}
turns keyword interceptor-specs into maps {::key <interceptor-key>}
keys which contain opaque data
keys which contain opaque data
(pr-loop-context* context step-fn)
Helper fn to repeat execution of step-fn
against context
inside a promise
loop.
step-fn
should return a tuple of either [::break <value>]
or [::recur <new context>]
. The former will terminate the loop and return <value>
, the
later will pass <new context>
to the next loop iteration.
(Note: this mainly exists to abstract away and minimise the platform specific aspects of handling promise loops.)
Helper fn to repeat execution of `step-fn` against `context` inside a promise loop. `step-fn` should return a tuple of either `[::break <value>]` or `[::recur <new context>]`. The former will terminate the loop and return `<value>`, the later will pass `<new context>` to the next loop iteration. (Note: this mainly exists to abstract away and minimise the platform specific aspects of handling promise loops.)
(record-interceptor-error resume-context next-context e)
wrap an exception and record the error
wrap an exception and record the error
(resolve-interceptor-data interceptor-fn-key interceptor-spec context)
resolve the interceptor data, returning either
resolve the interceptor data, returning either - [data-val] if there was data specified - nil if no data was specified
(resume app-ctx a-frame-router err-or-resume-context)
resume a failed interceptor chain, from either a thrown exception or a logged resume-context
resume a failed interceptor chain, from either a thrown exception or a logged resume-context
(rethrow e)
wrap an error in a marker exception for rethrowing rather than wrapping - allows an ::error fn to rethrow an error without confusing resume
wrap an error in a marker exception for rethrowing rather than wrapping - allows an ::error fn to rethrow an error without confusing resume
(rethrow? o)
returns an error to rethrow or nil
returns an error to rethrow or nil
(sanitise-context context)
remove impure / opaque data from a context
remove impure / opaque data from a context
(terminate context)
Removes all queued interceptors from context
Removes all queued interceptors from `context`
(unwrap-original-error e)
unwrap layers of error wrapping (in case of nested :dispatch) to get at the causal exception
unwrap layers of error wrapping (in case of nested :dispatch) to get at the causal exception
(unwrap-resume-context-original-error e)
unwrap layers of error wrapping (in case of nested :dispatch) to get at the resume context and the causal exception
returns : [<resume-context> <original-error>]
unwrap layers of error wrapping (in case of nested :dispatch) to get at the resume context and the causal exception returns : [<resume-context> <original-error>]
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close