[][src]Struct sudoku_backend::ops::errors::GenericError

pub struct GenericError {
    pub reason: Cow<'static, str>,
    pub severity: GenericErrorSeverity,
}

Use this for most non-specific errors.

Refer to doc/errors.md for more details.

Examples

#[get("/endpoint")]
fn endpoint() -> Result<String, Json<GenericError>> {
    work().map_err(|e| Json(GenericError {
        reason: format!("couldn't finish work: {}", e).into(),
        severity: GenericErrorSeverity::Warning,
    }))
}

fn main() {
    rocket::ignite()
        .mount("/", routes![endpoint])
        .launch();
}

Fields

In all-lowercase past-tense finishing-punctuation-free form.

For example: "failed to apply diff", "user with that name exists".

How bad the error is.

Trait Implementations

impl PartialEq<GenericError> for GenericError
[src]

impl Clone for GenericError
[src]

Performs copy-assignment from source. Read more

impl<R: Into<Cow<'static, str>>> From<(R, GenericErrorSeverity)> for GenericError
[src]

impl Ord for GenericError
[src]

Compares and returns the maximum of two values. Read more

Compares and returns the minimum of two values. Read more

impl Eq for GenericError
[src]

impl PartialOrd<GenericError> for GenericError
[src]

impl Debug for GenericError
[src]

impl Hash for GenericError
[src]

Feeds a slice of this type into the given [Hasher]. Read more

impl Serialize for GenericError
[src]

impl<'de> Deserialize<'de> for GenericError
[src]

Auto Trait Implementations

impl Send for GenericError

impl Sync for GenericError

Blanket Implementations

impl<T> From for T
[src]

impl<T, U> Into for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

impl<T, U> TryFrom for T where
    T: From<U>, 
[src]

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

impl<T> Borrow for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T, U> TryInto for T where
    U: TryFrom<T>, 
[src]

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

impl<T> BorrowMut for T where
    T: ?Sized
[src]

impl<T> DeserializeOwned for T where
    T: Deserialize<'de>, 
[src]

impl<T> Typeable for T where
    T: Any
[src]

Get the TypeId of this object.

impl<T> IntoSql for T
[src]

Convert self to an expression for Diesel's query builder. Read more

Convert &self to an expression for Diesel's query builder. Read more