Macro rocketjson_data::rjtry[][src]

macro_rules! rjtry {
    ($i : expr) => { ... };
}
Expand description

To forward Errors as [ApiResponseErr] rjtry can be used.

Requirements

the trait ApiErrorsCreate has to be in scope.

Example

use rocketjson::{ApiResponseErr, rjtry, error::ApiErrorsCreate};

pub async fn db_get_users() -> Result<String, diesel::result::Error> {
    ...
}

pub async fn is_admin() -> ApiResponseErr<bool> {
    let user = rjtry!(db_get_users().await);
    user == "admin"
}