Skip to content

Returning an error in a middleware when interrupting? #230

Answered by edobrb
Atlinx asked this question in Q&A
Discussion options

You must be logged in to vote

Throwing an exception is the correct way if you have an error. The early interruption of a middleware is to make everything go well without actually making the call on the db. Suppose we want to make a caching middleware, this can work by returning the result of the find in the before function.

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by Atlinx
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants