[][src]Struct kapitalist_types::response::ErrorResponse

pub struct ErrorResponse {
    pub error: String,
}

Generic error response with an error message indicating what went wrong

Clients should use the error message in combination with the HTTP return type to determine how to handle the error.

Fields

error: String

Message describing the error

Methods

impl ErrorResponse[src]

pub fn new<S>(err: S) -> Self where
    S: Into<String>, 
[src]

Construct a new ErrorResponse from a given error message

pub fn internal_server_error() -> Self[src]

Utility function to return a generic "Internal server error"

This is usually used in production to hide potentially sensitive error details.

pub fn not_implemented() -> Self[src]

Utility function to return a generic "Not implemented yet" error

pub fn unauthorized() -> Self[src]

Utility function to return a generic "Unauthorized" error

Trait Implementations

impl Debug for ErrorResponse[src]

impl Serialize for ErrorResponse[src]

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

Auto Trait Implementations

Blanket Implementations

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

impl<T> From for T[src]

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

type Error = Infallible

The type returned in the event of a conversion error.

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

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

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

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

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

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