core icon indicating copy to clipboard operation
core copied to clipboard

Add error handling to all api routes

Open gemcoder21 opened this issue 1 year ago • 1 comments

We can extend endpoint like get_name_resolve, to return a custom error struct

#[get("/name/resolve/<name>?<chain>")]
pub async fn get_name_resolve(
    name: &str,
    chain: &str,
    name_client: &State<Mutex<NameClient>>,
) -> Result<Json<NameRecord>, NotFound<String>> {
...
}

gemcoder21 avatar Mar 18 '24 16:03 gemcoder21

https://rocket.rs/guide/v0.4/requests/#error-catchers

0xh3rman avatar Mar 19 '24 01:03 0xh3rman

Come back to this later

gemcoder21 avatar Dec 18 '24 17:12 gemcoder21