#anyhow #rocket #error #responder #throw

rocket_anyhow

throw any error inside rocket's route

3 unstable releases

0.2.0 Sep 27, 2025
0.1.1 Apr 23, 2021
0.1.0 Apr 23, 2021

#1 in #throw

Download history 2/week @ 2025-10-07 30/week @ 2025-10-14 12/week @ 2025-10-21 1/week @ 2025-10-28

136 downloads per month
Used in pixelpwnr-exporter

MIT license

15KB

This library provided [rocket_anyhow::Error][Error], a wrapper around anyhow::Error with rocket's responder implemented.

use std::io::Write;

#[post("/<path..>", data="<text>")]
fn write_utf8_to(path: std::path::PathBuf, text: Vec<u8>) -> rocket_anyhow::Result {
   let mut file = std::fs::File::open(path)?;
   let text = std::str::from_utf8(&text)?;
   file.write_all(text.as_ref())?;
   Ok(())
}


rocket_anyhow

This library provided rocket_anyhow::Error, a wrapper around anyhow::Error with rocket's responder implemented.

use std::io::Write;

#[post("/<path..>", data="<text>")]
fn write_utf8_to(path: std::path::PathBuf, text: Vec<u8>) -> rocket_anyhow::Result {
   let mut file = std::fs::File::open(path)?;
   let text = std::str::from_utf8(&text)?;
   file.write_all(text.as_ref())?;
   Ok(())
}

Dependencies

~20–57MB
~833K SLoC