Add Error page and error handling

Signed-off-by: Fred Boniface <fred@fjla.uk>
This commit is contained in:
Fred Boniface 2023-01-26 20:09:02 +00:00
parent 1a17ece66e
commit 8878902679
4 changed files with 64 additions and 0 deletions

30
static/404.html Normal file
View File

@ -0,0 +1,30 @@
<html>
<head>
<meta charset="UTF-8"/>
<meta name="description" content="OwlBoard - Live train departures for traincrew."/>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="application-name" content="OwlBoard">
<meta name="author" content="Frederick Boniface">
<meta name="theme-color" content="#155bb7">
<link rel="stylesheet" type="text/css" href="./styles/main.css"/>
<link rel="icon" type="image/svg+xml" href="./images/icon.svg"/>
<link rel="manifest" type="application/json" href="./manifest.json"/>
<!-- NO SCRIPTS LOADED - NOT REQUIRED AT PRESENT -->
<title>OwlBoard - Error</title>
</head>
<body>
<div id="top_button" class="hide_micro">
<button aria-label="Back" class="sidebar_control" onclick="history.back()">&#8678;</button>
</div>
<picture>
<source srcset="/images/logo/wide_logo.svg" type="image/svg+xml">
<source media="(max-height: 739px)" srcset="/images/logo/logo-full-200.png" type="image/png">
<source srcset="/images/logo/logo-full-250.png" type="image/png">
<img class="titleimg" src="/images/logo/logo-full-250.png" alt="OwlBoard Logo">
</picture>
<h2>Oh no!</h2>
<p>That page cannot be found</p>
<p>Try going to the <a href="/">homepage</a></p>
<p>Error number: 404</p>
</body>
</html>

30
static/50x.html Normal file
View File

@ -0,0 +1,30 @@
<html>
<head>
<meta charset="UTF-8"/>
<meta name="description" content="OwlBoard - Live train departures for traincrew."/>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="application-name" content="OwlBoard">
<meta name="author" content="Frederick Boniface">
<meta name="theme-color" content="#155bb7">
<link rel="stylesheet" type="text/css" href="./styles/main.css"/>
<link rel="icon" type="image/svg+xml" href="./images/icon.svg"/>
<link rel="manifest" type="application/json" href="./manifest.json"/>
<!-- NO SCRIPTS LOADED - NOT REQUIRED AT PRESENT -->
<title>OwlBoard - Error</title>
</head>
<body>
<div id="top_button" class="hide_micro">
<button aria-label="Back" class="sidebar_control" onclick="history.back()">&#8678;</button>
</div>
<picture>
<source srcset="/images/logo/wide_logo.svg" type="image/svg+xml">
<source media="(max-height: 739px)" srcset="/images/logo/logo-full-200.png" type="image/png">
<source srcset="/images/logo/logo-full-250.png" type="image/png">
<img class="titleimg" src="/images/logo/logo-full-250.png" alt="OwlBoard Logo">
</picture>
<h2>Oh no!</h2>
<p>OwlBoard has encountered a Server Error</p>
<p>Try going to the <a href="/">homepage</a></p>
<p>Error number: 50x</p>
</body>
</html>

View File

@ -32,6 +32,8 @@ http {
index index.html;
gzip_static on;
brotli_static on;
error_page 404 /404.html;
error_page 500 501 502 503 504 505 /50x.html;
}
location /api/ {

View File

@ -23,6 +23,8 @@ async function init() {
var data = null
setLoadingDesc(`Handling\nError`)
log("init: Unable to fetch LDB data")
await delay(2000);
location.reload();
}
}
}