fastboot-express-middleware icon indicating copy to clipboard operation
fastboot-express-middleware copied to clipboard

Adds an onFailure callback to delegate error handling to the app

Open jasonmit opened this issue 9 years ago • 5 comments

This adds an onFailure hook that can be passed into the fastboot middleware.

The use case is apps may already have a way of handling errors. This allows someone to inject their own handler logic, which could be as simple as next(err) to allow their apps error handler to take over.

jasonmit avatar Jun 12 '16 07:06 jasonmit

Rather than introducing a new callback, I think (in the interests of Express ecosystem consistency) we should consider copying the fallthrough API from express.static().

tomdale avatar Jun 24 '16 17:06 tomdale

Sounds great, what should I default to?

jasonmit avatar Jun 24 '16 18:06 jasonmit

static() defaults to true, but I think that probably gets used standalone less than FastBoot. false would preserve our current semantics, which IMO are correct, but I'm open to hearing from others who disagree.

tomdale avatar Jun 29 '16 15:06 tomdale

we can probably close this now that #11 is merged.

arjansingh avatar Sep 22 '16 18:09 arjansingh

I believe what I'm after is slightly different, I want to delegate error handling entirely to the caller.

In #11 it looks like it res.send with html in some cases which might conflict with whatever the error handler is doing.

jasonmit avatar Sep 22 '16 22:09 jasonmit