Skip to content

Add ignoreErrors option to harden against store fetch errors#525

Closed
walling wants to merge 1 commit into
expressjs:masterfrom
walling:master
Closed

Add ignoreErrors option to harden against store fetch errors#525
walling wants to merge 1 commit into
expressjs:masterfrom
walling:master

Conversation

@walling

@walling walling commented Nov 20, 2017

Copy link
Copy Markdown

This option allows to ignore any fetch error from the store. That means that req.session will be undefined and as stated in the readme, the application needs to be able to handle that gracefully. However it makes it possible for the application developer to decide what should happen on errors instead of just returning HTTP 500 for the request.

This is something that is very useful for ourselves, since we want to ensure a high uptime for our website and funnel, even if it means we miss some session tracking in a few cases.

Let me know if you have any questions.

@gabeio gabeio added the pr label Dec 9, 2017
@dougwilson

Copy link
Copy Markdown
Contributor

Hi @walling having an undefined req.session creates even more problems. We are moving towards only forwarding errors in 2.x due to the massive feedback received. If you want to handle the errors, just either (a) add an error-handling middleware after your session middleware and swallow the error by just next()ing or (b) wrap this middleware in a function that ignores the error and just next()s. Ignoring the error is very simple and not necessary to add an option -- just implement the same way you would implement an "ignore all middleware errors" for every middleware out there, no need for every middleware everywhere to add an option 👍

@dougwilson dougwilson closed this Dec 19, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants