summaryrefslogtreecommitdiffstats
path: root/front_end
diff options
context:
space:
mode:
authorKornel <kornel@geekhood.net>2020-02-27 01:53:42 +0000
committerKornel <kornel@geekhood.net>2020-02-27 01:59:12 +0000
commit5d5068e39713761727000948339b369a48683161 (patch)
treedf34a3dee0b4c9f6785349d7eb5f70cfd1289339 /front_end
parent5ca742395cfa1b8214066d59b0fccf852b91b579 (diff)
Error page
Diffstat (limited to 'front_end')
-rw-r--r--front_end/src/front_end.rs4
-rw-r--r--front_end/templates/error_page.rs.html38
2 files changed, 42 insertions, 0 deletions
diff --git a/front_end/src/front_end.rs b/front_end/src/front_end.rs
index 0b08123..d57cf93 100644
--- a/front_end/src/front_end.rs
+++ b/front_end/src/front_end.rs
@@ -249,6 +249,10 @@ pub fn render_debug_page(out: &mut impl Write, ver: &RichCrateVersion, kitchen_s
Ok(())
}
+pub fn render_error(out: &mut impl Write, err: &failure::Error) {
+ templates::error_page(out, err).expect("error rendering error page");
+}
+
/// See `crate_page.rs.html`
pub fn render_static_page(out: &mut impl Write, title: String, page: &Markup, renderer: &Renderer) -> Result<(), failure::Error> {
if stopped() {
diff --git a/front_end/templates/error_page.rs.html b/front_end/templates/error_page.rs.html
new file mode 100644
index 0000000..a66db55
--- /dev/null
+++ b/front_end/templates/error_page.rs.html
@@ -0,0 +1,38 @@
+@use failure::Error;
+
+@(err: &Error)
+
+<!doctype html>
+<html lang="en">
+ <meta charset="utf-8">
+ <meta name="robots" content="noindex, nofollow">
+ <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
+ <title>error[E0500]: lib.rs:1</title>
+ <link rel=stylesheet href="/index.css" crossorigin="anonymous">
+ <link rel=stylesheet href="/critical.css" crossorigin="anonymous">
+ <link rel=icon href="/favicon.png">
+ <link rel="mask-icon" href="/logo.svg">
+ <meta name="theme-color" content="#aaaaaa">
+ <meta name="color-scheme" value="light dark">
+ <body>
+ <header>
+ <div class=inner-col>
+ <h1><code>error[E0500]: lib.rs:1</code></h1>
+ </div>
+ </header>
+ <main>
+ <div class=inner-col>
+ <h2>Sorry, something went wrong!</h2>
+ <p>@err</p>
+ <ol>
+ @for cause in err.iter_causes() {
+ <li>@cause</li>
+ }
+ </ol>
+ <hr />
+ <p>Try refreshing the page.</p>
+ <a href="/">Back to homepage.</a>
+ </div>
+ </main>
+ </body>
+</html>