This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2020-05-17
Channels
- # announcements (10)
- # aws (10)
- # babashka (11)
- # beginners (77)
- # calva (9)
- # cider (10)
- # cljdoc (7)
- # cljs-dev (47)
- # clojure (47)
- # clojure-uk (4)
- # clojurescript (87)
- # community-development (15)
- # conjure (14)
- # core-async (25)
- # cursive (6)
- # fulcro (6)
- # helix (3)
- # joker (2)
- # nrepl (1)
- # off-topic (1)
- # pathom (9)
- # pedestal (6)
- # re-frame (22)
- # reitit (15)
- # shadow-cljs (26)
- # spacemacs (16)
- # testing (2)
- # tools-deps (12)
- # uncomplicate (10)
- # xtdb (22)
@jdkealy Pedestal wraps all exceptions thrown by interceptors in an ExceptionInfo
. You can either get the cause off the thrown ExceptionInfo
pull it out of the ex-data
using the :exception
key. The joining of interceptor name and original message is not configurable. For additional attrs in ex-data, see http://pedestal.io/reference/error-handling
Hey. I also have a question about exceptions. In a ‘normal’ synchronous interceptor I can just raise (or not catch) exceptions, and they’ll eventually end up in an :error
interceptor. However, I can’t figure out what to do with exceptions occuring in asynchonous interceptors. The docs say they should return channels with context maps, and that exceptions are put in ::chain/error
in the context map wrapped in an ExceptionInfo
, but I am struggling to find out how to create such a wrapped exception to put in the context in my asynchronous interceptor.
Hi @UDF11HLKC, assoc an ex-info wrapping your exception to the context using the :io.pedestal.interceptor.chain/error
key. You can add the ex-data specified in http://pedestal.io/reference/error-handling#_error_function if you are dispatching on that info in a generic error handler. Currently the code which converts an exception to a wrapped exception is private and not part of the public api.
@UDF11HLKC
Not all the ex-data is required. It depends on what you are dispatching on. The ::chain/execution-id
is on the context but the stage
is not. You do, however, know the stage so can add that if necessary
Okay, I’ll do that then. Thank you for answering 🙂
Works like a charm :thumbsup: , can provide basically the same ex-data as pedestal would! Thanks again