[−][src]Struct interledger_http::error::ApiError
This struct represents the fields defined in RFC7807. The meaning of each field could be found at Members of a Problem Details Object section. ApiError implements Reply so that it could be used for responses.
Fields
type: &'static ProblemType
type
is a URI which represents an error type. The URI should provide human-readable
documents so that developers can solve the problem easily.
title: &'static str
title
is a short, human-readable summary of the type.
SHOULD NOT change from occurrence to occurrence of the problem, except for purposes
of localization.
status: StatusCode
status
is a HTTP status of the problem.
detail: Option<String>
detail
explains the problem in human-readable detail.
instance: Option<String>
instance
is a URI reference that identifies the specific occurrence of the problem.
We should be careful of how we provide the URI because if it provides very detailed
information about the error, it might expose some vulnerabilities of the node.
extension_members: Option<Map<String, Value>>
extension_members
is a Map of JSON values which will be flatly injected into response
JSONs. For example, if we specify extension_members
like:
"invalid-params": [
{ "name": "Username", "type": "missing" }
]
then this map is merged into the response JSON and will look like:
{
"type": "about:blank",
"title": "Missing Fields Error",
"status": 400,
"detail": "foo bar",
"invalid-params": [
{ "name": "Username", "type": "missing" }
]
}
Methods
impl ApiError
[src]
pub fn from_api_error_type(problem_type: &ApiErrorType) -> Self
[src]
pub fn bad_request() -> Self
[src]
pub fn internal_server_error() -> Self
[src]
pub fn unauthorized() -> Self
[src]
pub fn not_found() -> Self
[src]
pub fn method_not_allowed() -> Self
[src]
pub fn account_not_found() -> Self
[src]
pub fn idempotency_conflict() -> Self
[src]
pub fn invalid_account_id(invalid_account_id: Option<&str>) -> Self
[src]
pub fn invalid_ilp_packet() -> Self
[src]
pub fn detail<T>(self, detail: T) -> Self where
T: Into<String>,
[src]
T: Into<String>,
pub fn instance<T>(self, instance: T) -> Self where
T: Into<String>,
[src]
T: Into<String>,
pub fn extension_members(
self,
extension_members: Option<Map<String, Value>>
) -> Self
[src]
self,
extension_members: Option<Map<String, Value>>
) -> Self
Trait Implementations
impl From<ApiError> for Rejection
[src]
impl Clone for ApiError
[src]
impl Display for ApiError
[src]
impl Debug for ApiError
[src]
impl Error for ApiError
[src]
fn description(&self) -> &str
1.0.0[src]
fn cause(&self) -> Option<&dyn Error>
1.0.0[src]
fn source(&self) -> Option<&(dyn Error + 'static)>
1.30.0[src]
fn backtrace(&self) -> Option<&Backtrace>
[src]
impl Serialize for ApiError
[src]
fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error> where
__S: Serializer,
[src]
__S: Serializer,
impl Reply for ApiError
[src]
fn into_response(self) -> Response
[src]
Auto Trait Implementations
impl Send for ApiError
impl Sync for ApiError
impl Unpin for ApiError
impl UnwindSafe for ApiError
impl RefUnwindSafe for ApiError
Blanket Implementations
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From<T> for T
[src]
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
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<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<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Same<T> for T
type Output = T
Should always be Self
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> AsFail for T where
T: Fail,
T: Fail,
fn as_fail(&self) -> &(dyn Fail + 'static)
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
U: TryFrom<T>,