[−][src]Struct exonum_api::Error
API HTTP error struct.
Fields (Non-exhaustive)
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional
Struct { .. }
syntax; cannot be matched against without a wildcard ..
; and struct update syntax will not work.http_code: HttpStatusCode
HTTP error code.
body: ErrorBody
API error body.
headers: HeaderMap
Additional HTTP headers.
Methods
impl Error
[src]
pub fn new(http_code: HttpStatusCode) -> Self
[src]
Builds a ApiError with the given http_code
.
pub fn bad_request() -> Self
[src]
Builds Bad Request (400) error.
pub fn forbidden() -> Self
[src]
Builds Forbidden (403) error.
pub fn not_found() -> Self
[src]
Builds Not Found (404) error.
pub fn internal(cause: impl Display) -> Self
[src]
Builds Internal Server Error (500).
pub fn docs_uri(self, docs_uri: impl Into<String>) -> Self
[src]
Sets docs_uri
of an error.
pub fn title(self, title: impl Into<String>) -> Self
[src]
Sets title
of an error.
pub fn detail(self, detail: impl Into<String>) -> Self
[src]
Sets detail
of an error.
pub fn error_code(self, error_code: u8) -> Self
[src]
Sets error_code
of an error.
pub fn parse(http_code: HttpStatusCode, body: &str) -> Result<Self, Error>
[src]
Tries to create ApiError
from JSON.
Trait Implementations
impl Debug for Error
[src]
impl Default for Error
[src]
impl Display for Error
[src]
impl Error for Error
[src]
fn source(&self) -> Option<&(dyn Error + 'static)>
1.30.0[src]
fn backtrace(&self) -> Option<&Backtrace>
[src]
fn description(&self) -> &str
1.0.0[src]
fn cause(&self) -> Option<&dyn Error>
1.0.0[src]
impl From<MovedPermanentlyError> for Error
[src]
fn from(e: MovedPermanentlyError) -> Self
[src]
impl ResponseError for ApiError
[src]
fn error_response(&self) -> HttpResponse
[src]
fn status_code(&self) -> StatusCode
Auto Trait Implementations
impl RefUnwindSafe for Error
impl Send for Error
impl Sync for Error
impl Unpin for Error
impl UnwindSafe for Error
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> AsFail for T where
T: Fail,
T: Fail,
fn as_fail(&self) -> &(dyn Fail + 'static)
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<E> Fail for E where
E: 'static + Error + Send + Sync,
E: 'static + Error + Send + Sync,
fn name(&self) -> Option<&str>
fn cause(&self) -> Option<&(dyn Fail + 'static)>
fn backtrace(&self) -> Option<&Backtrace>
fn context<D>(self, context: D) -> Context<D> where
D: Display + Send + Sync + 'static,
D: Display + Send + Sync + 'static,
fn compat(self) -> Compat<Self>
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToString for T where
T: Display + ?Sized,
[src]
T: Display + ?Sized,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
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, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,