[−][src]Struct nickel::NickelError
NickelError is the basic error type for HTTP errors as well as user defined errors.
One can pattern match against the kind
property to handle the different cases.
Fields
stream: Option<Response<'a, D, Streaming>>
message: Cow<'static, str>
Methods
impl<'a, D> NickelError<'a, D>
[src]
impl<'a, D> NickelError<'a, D>
pub fn new<T>( | [src] |
Creates a new NickelError
instance.
You should probably use Response#error
in favor of this.
Examples
use nickel::{Request, Response, MiddlewareResult, NickelError}; use nickel::status::StatusCode; fn handler<'a, D>(_: &mut Request<D>, res: Response<'a, D>) -> MiddlewareResult<'a, D> { Err(NickelError::new(res, "Error Parsing JSON", StatusCode::BadRequest)) }
pub unsafe fn without_response<T>(message: T) -> NickelError<'a, D> where | [src] |
Creates a new NickelError
without a Response
.
This should only be called in a state where the Response
has
failed in an unrecoverable state. If there is an available
Response
then it must be provided to new
so that the
underlying stream can be flushed, allowing future requests.
This is considered unsafe
as deadlock can occur if the Response
does not have the underlying stream flushed when processing is finished.
pub fn end(self) -> Option<Result<()>> | [src] |
Trait Implementations
impl<'a, T, D> From<(Response<'a, D, Fresh>, (StatusCode, T))> for NickelError<'a, D> where
T: Into<Box<dyn Error + 'static>>,
[src]
impl<'a, T, D> From<(Response<'a, D, Fresh>, (StatusCode, T))> for NickelError<'a, D> where
T: Into<Box<dyn Error + 'static>>,
fn from( | [src] |
impl<'a, D> From<(Response<'a, D, Fresh>, String)> for NickelError<'a, D>
[src]
impl<'a, D> From<(Response<'a, D, Fresh>, String)> for NickelError<'a, D>
impl<'a, D> From<(Response<'a, D, Fresh>, StatusCode)> for NickelError<'a, D>
[src]
impl<'a, D> From<(Response<'a, D, Fresh>, StatusCode)> for NickelError<'a, D>
fn from((res, code): (Response<'a, D>, StatusCode)) -> NickelError<'a, D> | [src] |
Auto Trait Implementations
impl<'a, D = ()> !Send for NickelError<'a, D>
impl<'a, D = ()> !Send for NickelError<'a, D>
impl<'a, D = ()> !Sync for NickelError<'a, D>
impl<'a, D = ()> !Sync for NickelError<'a, D>
Blanket Implementations
impl<T> From for T
[src]
impl<T> From for T
impl<T, U> Into for T where
U: From<T>,
[src]
impl<T, U> Into for T where
U: From<T>,
impl<T, U> TryFrom for T where
T: From<U>,
[src]
impl<T, U> TryFrom for T where
T: From<U>,
type Error = !
try_from
)The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error> | [src] |
impl<T> Borrow for T where
T: ?Sized,
[src]
impl<T> Borrow for T where
T: ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src]
impl<T> BorrowMut for T where
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T | [src] |
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
impl<T, U> TryInto for T where
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
try_from
)The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error> | [src] |
impl<T> Any for T where
T: 'static + ?Sized,
[src]
impl<T> Any for T where
T: 'static + ?Sized,
fn get_type_id(&self) -> TypeId | [src] |
impl<T> Typeable for T where
T: Any,
impl<T> Typeable for T where
T: Any,
impl<T> UnsafeAny for T where
T: Any,
impl<T> UnsafeAny for T where
T: Any,