diff --git a/infrastructure/web/routes/error.js b/infrastructure/web/routes/error.js
deleted file mode 100644
index 64bdb15..0000000
--- a/infrastructure/web/routes/error.js
+++ /dev/null
@@ -1,21 +0,0 @@
-const express = require('express')
-
-const router = new express.Router()
-const config = require('../../../application/config')
-
-router.get(
- '^/:404',
- async (req, res) => {
- res.render('error', {
- title: "48hr.email | 404",
- message: error.message,
- status: 404,
- address: req.params.address,
- stack: error.stack,
- madeby: config.branding[1],
- madebysite: config.branding[2]
- })
- }
-)
-
-module.exports = router
diff --git a/infrastructure/web/routes/inbox.js b/infrastructure/web/routes/inbox.js
index 78f713c..4583d85 100644
--- a/infrastructure/web/routes/inbox.js
+++ b/infrastructure/web/routes/inbox.js
@@ -44,7 +44,15 @@ router.get(
madebysite: config.branding[2]
})
} else {
- res.redirect('/404')
+ res.render(
+ 'error',
+ {
+ address: req.params.address,
+ message: 'This mail could not be found. It either does not exist or has been deleted from our servers!',
+ madeby: config.branding[1],
+ madebysite: config.branding[2],
+ }
+ )
}
} catch (error) {
console.error('error while fetching one email', error)
diff --git a/infrastructure/web/views/error.twig b/infrastructure/web/views/error.twig
index a428599..79bd16e 100644
--- a/infrastructure/web/views/error.twig
+++ b/infrastructure/web/views/error.twig
@@ -5,13 +5,10 @@
← Return to inbox
-
- Delete Email
-
Logout
-
+
{{stack}}+
{{error.stack}}{% endblock %} diff --git a/infrastructure/web/web.js b/infrastructure/web/web.js index 3670769..09531d4 100644 --- a/infrastructure/web/web.js +++ b/infrastructure/web/web.js @@ -11,7 +11,6 @@ const socketio = require('socket.io') const config = require('../../application/config') const inboxRouter = require('./routes/inbox') const loginRouter = require('./routes/login') -const errorRouter = require('./routes/error') const {sanitizeHtmlTwigFilter} = require('./views/twig-filters') // Init express middleware @@ -50,7 +49,6 @@ app.get('/', (req, res, _next) => { app.use('/', loginRouter) app.use('/inbox', inboxRouter) -app.use('/404', errorRouter) // Catch 404 and forward to error handler app.use((req, res, next) => {