Sneruall / soloswimnl

Webshop for a project that focuses on offering waterproof swimming schedules for in the pool. Using React, NextJS, NodeJS, Stripe, MongoDB and TailwindCSS.
https://www.soloswim.nl
0 stars 1 forks source link

apply error throwing for technical errors and redirecting to 500 page #79

Open Sneruall opened 2 years ago

Sneruall commented 2 years ago

express:

.catch((err) => {
  const error = new Error(err);
  error.httpStatusCode = 500;
  return next(error);
});

app.use((error, req, res, next) => { // res.status(error.httpStatusCode).render(...); res.redirect('/500'); })

find out how this works for nextJS apps