(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.
(wrap-ex-info-context context & body)This macro has two functions, achieved by wrapping some body of code:
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).
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.
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 |