album/templates/error.rs.html
Rasmus Kaj c3aa86cb42 Improve error handling.
Views now returns `Result<T: Reply, ViewError>`.
There is a difference between a `ViewError` (an error that can be
represented as a http response) and a `Rejection` (which tells the
warp filter system to try other possible handlers).
Get rid of lots of "unwrap" (potential panics) in view handlers.
2022-02-16 22:44:59 +01:00

39 lines
1.3 KiB
HTML

@use super::statics::{photos_css, ux_js};
@use warp::http::StatusCode;
@(code: StatusCode, message: &str, detail: &str)
<!doctype html>
<html>
<head>
<title>Error @code.as_u16() @code.canonical_reason().unwrap_or("error")</title>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<link rel="stylesheet" href="/static/@photos_css.name" type="text/css"/>
<script src="/static/@ux_js.name" type="text/javascript" defer>
</script>
</head>
<body>
<header>
<span><a href="/" accesskey="h" title="Images from all years">Images</a>
</span>
<span>· <a href="/tag/">Tags</a></span>
<span>· <a href="/person/">People</a></span>
<span>· <a href="/place/">Places</a></span>
<span>· <a href="/thisday">On this day</a></span>
<span>· <a href="/random" accesskey="r">Random pic</a></span>
<span class="user"></span>
</header>
<main>
<h1>@code.canonical_reason().unwrap_or("error")</h1>
<p>@message (@code.as_u16())</p>
<p>@detail</p>
</main>
<footer>
<p>Managed by
<a href="https://github.com/kaj/rphotos">rphotos
@env!("CARGO_PKG_VERSION")</a>.</p>
</footer>
</body>
</html>