aboutsummaryrefslogtreecommitdiffstats
path: root/src/main.rs
diff options
context:
space:
mode:
authorLibravatar cel 🌸 <cel@blos.sm>2023-02-16 18:02:20 +0000
committerLibravatar cel 🌸 <cel@blos.sm>2023-02-16 18:02:20 +0000
commit675081e9d28ab7f072e82446a52a8bd26382ed66 (patch)
tree45574a4245eb41b940fc241cdd6b560f10576686 /src/main.rs
parent059cf500e7cd98de88c59d6824354a3d2d87fc89 (diff)
downloadblossom-675081e9d28ab7f072e82446a52a8bd26382ed66.tar.gz
blossom-675081e9d28ab7f072e82446a52a8bd26382ed66.tar.bz2
blossom-675081e9d28ab7f072e82446a52a8bd26382ed66.zip
improve error handling
Diffstat (limited to '')
-rw-r--r--src/main.rs11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/main.rs b/src/main.rs
index ba7bed0..1850b01 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -20,7 +20,10 @@ extern crate rocket;
async fn home(clients: &State<Clients>) -> Result<Template, BlossomError> {
Ok(Template::render(
"home",
- context! { is_live: false, listenbrainz: scrobbles::get_now_playing(&clients.listenbrainz).await?, skweets: skweets::get_recents(&clients.skinnyverse).await? },
+ context! {
+ is_live: false,
+ listenbrainz: scrobbles::get_now_playing(&clients.listenbrainz).await.unwrap_or_default(),
+ skweets: skweets::get_recents(&clients.skinnyverse).await.unwrap_or_default() },
))
}
@@ -31,7 +34,7 @@ async fn contact() -> Template {
#[get("/plants")]
async fn plants() -> Result<Template, BlossomError> {
- todo!()
+ Err(BlossomError::Unimplemented(Status::NotImplemented))
}
#[catch(default)]
@@ -44,7 +47,7 @@ fn catcher(status: Status, req: &Request) -> Template {
} else if status.code == 501 {
message = "it looks like this is not yet here!!!";
} else {
- message = "there was an error";
+ message = "idk i got bored";
}
let status = format!("{}", status);
Template::render(
@@ -66,7 +69,7 @@ async fn main() -> Result<(), rocket::Error> {
.attach(Template::custom(|engines| {
engines.tera.autoescape_on(vec![]);
}))
- .mount("/", routes![home, contact])
+ .mount("/", routes![home, contact, plants])
.register("/", catchers![catcher])
.mount("/", FileServer::from(relative!("static")))
.launch()