zestedesavoir / zmarkdown

Live demo: https://zestedesavoir.github.io/zmarkdown/
MIT License
226 stars 52 forks source link

[zmarkdown] Fixes Sentry error handling #455

Closed Situphen closed 2 years ago

Situphen commented 2 years ago

Quoting Sentry's documentation:

The error handler must be before any other error middleware and after all controllers

I tried it on Zeste de Savoir's staging server using this custom route to generate an error:

app.get("/debug-sentry", function mainHandler(req, res) {
  throw new Error("My first Sentry error!");
});

Currently, the error is logged in .pm2/logs/ but not sent to Sentry. With these changes, it is logged and sent to Sentry.