Add error pages

This commit is contained in:
Elara 2020-11-11 18:11:12 -08:00
parent a6aab8f975
commit ad8fc19750
4 changed files with 56 additions and 8 deletions

View File

@ -1,7 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<Workspace
version = "1.0">
<FileRef
location = "self:">
</FileRef>
</Workspace>

24
Resources/Views/404.leaf Normal file
View File

@ -0,0 +1,24 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>Not Found</title>
<link rel="stylesheet" type="text/css" href="/tabler/css/tabler.css">
<link rel="stylesheet" type="text/css" href="/tabler/css/dashboard.css">
<script src="/tabler/js/core.js"></script>
<script src="/tabler/js/dashboard.js"></script>
</head>
<body class="">
<div class="page">
<div class="page-content">
<div class="container text-center">
<div class="display-1 text-muted mb-5"><i class="si si-exclamation"></i> 404</div>
<h1 class="h2 mb-3">This page wasn't found on our server</h1>
<p class="h4 text-muted font-weight-normal mb-7">Either the page was removed or you clicked on a bad link&hellip;</p>
<a class="btn btn-primary" href="javascript:history.back()">
<i class="fe fe-arrow-left mr-2"></i>Go back
</a>
</div>
</div>
</div>
</body>
</html>

View File

@ -0,0 +1,31 @@
<!doctype html>
<!DOCTYPE html>
<html lang="en">
<head>
<title>#(statusMessage)</title>
<link rel="stylesheet" type="text/css" href="/tabler/css/tabler.css">
<link rel="stylesheet" type="text/css" href="/tabler/css/dashboard.css">
<script src="/tabler/js/core.js"></script>
<script src="/tabler/js/dashboard.js"></script>
</head>
<body class="">
<div class="page">
<div class="page-content">
<div class="container text-center">
<div class="display-1 text-muted mb-5"><i class="si si-exclamation"></i> #(status)</div>
<h1 class="h2 mb-3">
#if(reason ?? false):
#(reason)
#else:
#(statusMessage)
#endif
</h1>
<p class="h4 text-muted font-weight-normal mb-7">If you have done everything properly, please try again later&hellip;</p>
<a class="btn btn-primary" href="javascript:history.back()">
<i class="fe fe-arrow-left mr-2"></i>Go back
</a>
</div>
</div>
</div>
</body>
</html>

View File

@ -4,9 +4,9 @@ import LeafErrorMiddleware
// configures your application // configures your application
public func configure(_ app: Application) throws { public func configure(_ app: Application) throws {
app.middleware.use(LeafErrorMiddleware())
// Serve files from /Public // Serve files from /Public
app.middleware.use(FileMiddleware(publicDirectory: app.directory.publicDirectory)) app.middleware.use(FileMiddleware(publicDirectory: app.directory.publicDirectory))
app.middleware.use(LeafErrorMiddleware())
// Configure Leaf // Configure Leaf
LeafOption.caching = app.environment.isRelease ? .default : .bypass LeafOption.caching = app.environment.isRelease ? .default : .bypass