1. Atlassian
  2. Atlassian Connect
  3. atlassian-connect-express
  4. Pull requests

Pull requests

#10 Declined

AC-797 redirecting to error page if there are errors in middleware

  1. Roberto Dominguez

just need to define errorPage in your config.json and any error in the middleware will be redirected there

  • Dependencies Checking for dependencies...
  • Dependents Checking for dependents...

Comments (4)

  1. Rich Manalang

    I'm having second thoughts about this because:

    1. It only handles OAuth mw errors. Setting the errorPage prop in the config.json is misleading in that it appears to be a general error page.
    2. Even after setting the errorPage property, you still have to define a route that handles that. I suppose we can automatically configure this.

    What if we created a generic error handler much higher up in the stack so that we can use it in other places?

    1. Roberto Dominguez author

      Yeah, good idea on making a more generic one and creating a default handler... however:

      • You may want to do more than just redirecting. In our app, we actually send a hipchat message when something goes wrong
      • I can see the error page even being a static page...

      But I agree, it'd be a good idea moving an error page higher in the page. Doing something else when an error happen could be handled with an event handler