yetanalytics / lrs

Protocols, specifications, and logic for building an xAPI Learning Record Store (LRS) in Clojure(Script).
https://www.yetanalytics.com/lrs
Apache License 2.0
4 stars 1 forks source link

LRS-61 Remove Error Interceptor #71

Closed milt closed 2 years ago

milt commented 2 years ago

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 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.