Exception handling should be delegated to implementations based on their needs regarding logging, security, etc.
We were applying an error handling interceptor erroneously to all the routes but doc, this has been changed (see below)
We also included errors in the return spec for sync lrs methods, but did not catch and ensure these were included for the lib handling to use. Catching and passing of errors has been standardized across all sync method wrappers in lrs.cljc with the exception of consistent-through, which is called by an interceptor and functions differently.
Any error that is not explicitly handled by the lrs layer (a narrow class of specific named errors) will now be properly placed in the pedestal context map. Implementations can apply any error handling they wish by providing an error interceptor in the :wrap-interceptors vector passed to routes/build.
UPDATE: The default for the :wrap-interceptors vector is now [i/error-interceptor] per @kelvinqian00's request, meaning the default behavior will not change for implementations, though it will now also apply to doc routes which it did not before.
[x] remove error interceptor from common interceptors
[x] add :wrap-interceptors arg to routs build for passing your own global interceptors
[x] make return less weird for implementations that want to use it
[x] ensure handler fns are properly passing thrown impl errors and not covering what should be 500s
LET MY PEOPLE THROW (Kinda)
Exception handling should be delegated to implementations based on their needs regarding logging, security, etc.
We were applying an error handling interceptor erroneously to all the routes but doc, this has been changed (see below)
We also included errors in the return spec for sync
lrs
methods, but did not catch and ensure these were included for the lib handling to use. Catching and passing of errors has been standardized across all sync method wrappers inlrs.cljc
with the exception ofconsistent-through
, which is called by an interceptor and functions differently.Any error that is not explicitly handled by the
lrs
layer (a narrow class of specific named errors) will now be properly placed in the pedestal context map. Implementations can apply any error handling they wish by providing an error interceptor in the:wrap-interceptors
vector passed toroutes/build
.UPDATE: The default for the
:wrap-interceptors
vector is now[i/error-interceptor]
per @kelvinqian00's request, meaning the default behavior will not change for implementations, though it will now also apply to doc routes which it did not before.:wrap-interceptors
arg to routs build for passing your own global interceptors