Liking cljdoc? Tell your friends :D

quandary.error


*wrap-ex-info-context*clj


wrap-context-for-error-and-loggingcljmacro

(wrap-context-for-error-and-logging context & body)

Merges context into the ex-data of any exceptions thrown from body. An alias for wrap-ex-info-context; the name reflects its original intent of also enriching log messages (via timbre context), which is no longer in effect. NOTE: Uses of this macro are nestable.

Merges `context` into the ex-data of any exceptions thrown from `body`.
An alias for `wrap-ex-info-context`; the name reflects its original intent of also
enriching log messages (via timbre context), which is no longer in effect.
NOTE: Uses of this macro are nestable.
raw docstring

wrap-ex-info-contextcljmacro

(wrap-ex-info-context context & body)

This macro has two functions, achieved by wrapping some body of code:

  1. If an exception is thrown and uncaught, it will be caught here, the context values will be merged into the ex-data (if it is an ExceptionInfo), or just logged to ERROR (if not).

  2. For exceptions (or other scenarios) that are caught within the block and do not rise up to this scope, we don't see the exception and, therefore, can't adjust it. Instead, we provide a thread-local binding (which is recursively merged as we go down the stack). This binding (*wrap-ex-info-context*) can be accessed and utilized as desired within.

REMINDER for #2: This is a thread-local binding so, of course, any parallel operations (e.g. pmap) will not see the bindings.

This macro has two functions, achieved by wrapping some `body` of code:
1. If an exception is thrown and uncaught, it will be caught here, the `context` values
   will be merged into the ex-data (if it is an ExceptionInfo), or just logged to ERROR
   (if not).

2. For exceptions (or other scenarios) that are caught within the block and do not
   rise up to this scope, we don't see the exception and, therefore, can't adjust it.
   Instead, we provide a thread-local binding (which is recursively merged as we go down
   the stack). This binding (`*wrap-ex-info-context*`) can be accessed and utilized as
   desired within.

REMINDER for #2: This is a thread-local binding so, of course, any parallel operations
(e.g. pmap) will not see the bindings.
raw docstring

cljdoc builds & hosts documentation for Clojure/Script libraries

Keyboard shortcuts
Ctrl+kJump to recent docs
Move to previous article
Move to next article
Ctrl+/Jump to the search field
× close