aboutsummaryrefslogtreecommitdiff
path: root/examples/csrf/src
diff options
context:
space:
mode:
authorMartin Fischer <martin@push-f.com>2021-01-20 11:41:03 +0100
committerMartin Fischer <martin@push-f.com>2021-01-20 11:53:26 +0100
commitb886de1afc0b90d7ca27db9d5c7dabddbe3d7ee0 (patch)
tree6707f203caafd85a07c5842a2ac8146b7c325981 /examples/csrf/src
parentc55c4a49414f9dbcb637ba5ea765f4af9aebf807 (diff)
introduce Error::Simple and Error::Response
bump version to 0.2.2
Diffstat (limited to 'examples/csrf/src')
-rw-r--r--examples/csrf/src/main.rs9
1 files changed, 7 insertions, 2 deletions
diff --git a/examples/csrf/src/main.rs b/examples/csrf/src/main.rs
index 16b31a1..497bd66 100644
--- a/examples/csrf/src/main.rs
+++ b/examples/csrf/src/main.rs
@@ -37,8 +37,13 @@ async fn service(req: hyper::Request<hyper::Body>) -> Result<hyper::Response<hyp
let (mut parts, body) = sputnik::request::adapt(req);
match route(&mut parts, body).await {
Ok(res) => Ok(res.into()),
- Err(err) => Ok(err.response_builder().body(err.message.into()).unwrap())
- // you can easily wrap or log errors here
+ Err(err) => match err {
+ Error::Simple(err) => {
+ Ok(err.response_builder().body(err.message.into()).unwrap())
+ // you can easily wrap or log errors here
+ }
+ Error::Response(err) => Ok(err)
+ }
}
}