aboutsummaryrefslogtreecommitdiffstats
path: root/license-generator/src
diff options
context:
space:
mode:
authorTeddy Wing2018-11-13 22:10:13 +0100
committerTeddy Wing2018-11-13 22:10:13 +0100
commitd55de8c8cd746a7d5c537c3b2ca49994d3007b66 (patch)
treef3e223103684a088d1e288cbced8677337542ea2 /license-generator/src
parenta1184f48a0a4930f3e378860ba212051516b8717 (diff)
downloaddome-key-web-d55de8c8cd746a7d5c537c3b2ca49994d3007b66.tar.bz2
Add 400 error page
HTML copied from the 404 page, but I remove the `text-center` on the error message because it doesn't look good. Took a multiline message for me to realise it.
Diffstat (limited to 'license-generator/src')
-rw-r--r--license-generator/src/bin/license.rs5
-rw-r--r--license-generator/src/response.rs4
2 files changed, 9 insertions, 0 deletions
diff --git a/license-generator/src/bin/license.rs b/license-generator/src/bin/license.rs
index 8c77670..f35407b 100644
--- a/license-generator/src/bin/license.rs
+++ b/license-generator/src/bin/license.rs
@@ -55,6 +55,11 @@ where W: 'a + Write {
}
fn error_400(&mut self) {
+ let page_400 = include_str!("../../../400.html");
+ response::set_400(self.writer)
+ .and_then(|_|
+ Ok(write!(self.writer, "Content-Type: text/html\n\n{}", page_400)?)
+ ).unwrap_or(())
}
fn error_404(&mut self) {
diff --git a/license-generator/src/response.rs b/license-generator/src/response.rs
index cf91e4e..6809988 100644
--- a/license-generator/src/response.rs
+++ b/license-generator/src/response.rs
@@ -2,6 +2,10 @@ use std::io::Write;
use errors::*;
+pub fn set_400<W: Write>(w: &mut W) -> Result<()> {
+ Ok(writeln!(w, "Status: 400")?)
+}
+
pub fn set_403<W: Write>(w: &mut W) -> Result<()> {
Ok(writeln!(w, "Status: 403")?)
}