Skip to content

Node.js based forum software built for the modern web

feat: closes #11549, new error pages

Barış Soner Uşaklı83fca3162850
diff --git a/public/language/en-GB/global.json b/public/language/en-GB/global.json
index 75f9e2251b..09a90dea4c 100644
--- a/public/language/en-GB/global.json
+++ b/public/language/en-GB/global.json
@@ -10,7 +10,7 @@
"500.title": "Internal Error.",
"500.message": "Oops! Looks like something went wrong!",
"400.title": "Bad Request.",
- "400.message": "It looks like this link is malformed, please double-check and try again. Otherwise, return to the <a class=\"alert-link\" href='%1/'>home page</a>.",
+ "400.message": "It looks like this link is malformed, please double-check and try again.<br/><div class=\"text-sm text-muted\">Return to the <a href='%1/'>home page</a>.</div>",
"register": "Register",
"login": "Login",
diff --git a/public/language/en-GB/pages.json b/public/language/en-GB/pages.json
index 060156a76b..3f1863fd32 100644
--- a/public/language/en-GB/pages.json
+++ b/public/language/en-GB/pages.json
@@ -68,7 +68,7 @@
"confirm": "Email Confirmed",
- "maintenance.text": "%1 is currently undergoing maintenance. Please come back another time.",
+ "maintenance.text": "%1 is currently undergoing maintenance.<br/>Please come back another time.",
"maintenance.messageIntro": "Additionally, the administrator has left this message:",
"throttled.text": "%1 is currently unavailable due to excessive load. Please come back another time."
diff --git a/src/controllers/topics.js b/src/controllers/topics.js
index 3b7c42d958..4efbd29b6f 100644
--- a/src/controllers/topics.js
+++ b/src/controllers/topics.js
@@ -22,7 +22,7 @@ const upload_url = nconf.get('upload_url');
topicsController.get = async function getTopic(req, res, next) {
const tid = req.params.topic_id;
-
+ throw new Error('db connection not found');
if (
(req.params.post_index && !utils.isNumber(req.params.post_index) && req.params.post_index !== 'unread') ||
!utils.isNumber(tid)
diff --git a/src/views/400.tpl b/src/views/400.tpl
index 6658e27f99..fb10fcfa81 100644
--- a/src/views/400.tpl
+++ b/src/views/400.tpl
@@ -1,9 +1,12 @@
-<div class="alert alert-danger">
- <strong>[[global:400.title]]</strong>
+<div class="flex-fill">
+ <h2 class="fw-semibold tracking-tight text-center">[[global:400.title]]</h2>
- <p>{{{ if error }}}{error}{{{ else }}}[[global:400.message, {config.relative_path}]]{{{ end }}}</p>
-
- {{{ if returnLink }}}
- <p>[[error:goback]]</p>
- {{{ end }}}
+ <div class="mx-auto">
+ <div class="d-flex flex-column gap-3 justify-content-center text-center">
+ <div class="mx-auto p-4 bg-light border rounded">
+ <i class="text-secondary fa fa-fw fa-4x fa-triangle-exclamation"></i>
+ </div>
+ {{{ if error }}}{error}{{{ else }}}[[global:400.message, {config.relative_path}]]{{{ end }}}
+ </div>
+ </div>
</div>
diff --git a/src/views/403.tpl b/src/views/403.tpl
index a68d8672f8..806eceb30c 100644
--- a/src/views/403.tpl
+++ b/src/views/403.tpl
@@ -1,13 +1,15 @@
-<div class="alert alert-danger">
- <strong>[[global:403.title]]</strong>
+<div class="flex-fill">
+ <h2 class="fw-semibold tracking-tight text-center">[[global:403.title]]</h2>
- <p>{{{ if error }}}{error}{{{ else }}}[[global:403.message]]{{{ end }}}</p>
-
- {{{ if returnLink }}}
- <p>[[error:goback]]</p>
- {{{ end }}}
-
- {{{ if !loggedIn }}}
- <p>[[global:403.login, {config.relative_path}]]</p>
- {{{ end }}}
-</div>
\ No newline at end of file
+ <div class="mx-auto">
+ <div class="d-flex flex-column gap-3 justify-content-center text-center">
+ <div class="mx-auto p-4 bg-light border rounded">
+ <i class="text-secondary fa fa-fw fa-4x fa-key"></i>
+ </div>
+ {{{ if error }}}{error}{{{ else }}}[[global:403.message]]{{{ end }}}
+ {{{ if !loggedIn }}}
+ [[global:403.login, {config.relative_path}]]
+ {{{ end }}}
+ </div>
+ </div>
+</div>
diff --git a/src/views/500.tpl b/src/views/500.tpl
index e0ddffae26..b24f7342a3 100644
--- a/src/views/500.tpl
+++ b/src/views/500.tpl
@@ -1,10 +1,13 @@
-<div class="alert alert-danger">
- <strong>[[global:500.title]]</strong>
- <p>[[global:500.message]]</p>
- <p>{path}</p>
- {{{ if error }}}<p>{error}</p>{{{ end }}}
+<div class="flex-fill">
+ <h2 class="fw-semibold tracking-tight text-center">[[global:500.title]]</h2>
- {{{ if returnLink }}}
- <p>[[error:goback]]</p>
- {{{ end }}}
-</div>
+ <div class="mx-auto">
+ <div class="d-flex flex-column gap-3 justify-content-center text-center">
+ <div class="mx-auto p-4 bg-light border rounded">
+ <i class="text-secondary fa fa-fw fa-4x fa-triangle-exclamation"></i>
+ </div>
+ [[global:500.message]]
+ {{{ if error }}}<div class="text-sm text-muted">{error}</div>{{{ end }}}
+ </div>
+ </div>
+</div>
\ No newline at end of file
diff --git a/src/views/503.tpl b/src/views/503.tpl
index 2654ab8429..800de34b7d 100644
--- a/src/views/503.tpl
+++ b/src/views/503.tpl
@@ -1,12 +1,15 @@
-<h1 class="text-center">[[pages:maintenance.text, {site_title}]]</h1>
-<h2 class="text-center"><i class="fa fa-wrench fa-3x"></i></h2>
-{{{ if message }}}
-<div class="row maintenance">
- <div class="col-sm-10 col-sm-offset-1 col-md-8 col-md-offset-2">
- <p class="lead text-center">[[pages:maintenance.messageIntro]]</p>
- <div class="well">
- {message}
+<div class="flex-fill">
+ <h2 class="fw-semibold tracking-tight text-center">[[pages:maintenance.text, {site_title}]]</h2>
+
+ <div class="mx-auto">
+ <div class="d-flex flex-column gap-3 justify-content-center text-center">
+ <div class="mx-auto p-4 bg-light border rounded">
+ <i class="text-secondary fa fa-fw fa-4x fa-wrench"></i>
+ </div>
+ {{{ if message }}}
+ [[pages:maintenance.messageIntro]]
+ <div class="text-sm text-muted">{message}</div>
+ {{{ end }}}
</div>
</div>
</div>
-{{{ end }}}
\ No newline at end of file