aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorFuwn <[email protected]>2022-04-25 01:13:51 -0700
committerFuwn <[email protected]>2022-04-25 01:13:51 -0700
commit48004dfffe4c7a57aa8773c09a562f9ea5e1e9ca (patch)
treec2ec8171400d7bfc4ba5ef1609d280ea73f2f8c7 /src
parentrefactor(modules): move static mounts to modules (diff)
downloadlocus-48004dfffe4c7a57aa8773c09a562f9ea5e1e9ca.tar.xz
locus-48004dfffe4c7a57aa8773c09a562f9ea5e1e9ca.zip
refactor(router): move error handler to constant
Diffstat (limited to 'src')
-rw-r--r--src/main.rs11
1 files changed, 5 insertions, 6 deletions
diff --git a/src/main.rs b/src/main.rs
index b3820d5..a1beda9 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -46,6 +46,10 @@ use windmark::{Response, Router};
use yarte::Template;
const SEARCH_SIZE: usize = 10;
+const ERROR_HANDLER_RESPONSE: &str =
+ "The requested resource could not be found at this time. You can try \
+ refreshing the page, if that doesn't change anything; contact Fuwn! \
static DATABASE: SyncLazy<Mutex<PickleDb>> = SyncLazy::new(|| {
Mutex::new({
@@ -130,12 +134,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
.unwrap();
}));
router.set_error_handler(Box::new(|_| {
- Response::NotFound(
- "The requested resource could not be found at this time. You can try \
- refreshing the page, if that doesn't change anything; contact Fuwn! \
- .into(),
- )
+ Response::NotFound(ERROR_HANDLER_RESPONSE.into())
}));
router.set_fix_path(true);