Struct dcaf::endpoints::token_req::ErrorResponse
source · pub struct ErrorResponse {
pub error: ErrorCode,
pub description: Option<String>,
pub uri: Option<String>,
}
Expand description
Details about an error which occurred for an access token request.
For more information, see section 5.8.3 of RFC 9200.
Use the ErrorResponseBuilder
(which you can access using the
ErrorResponse::builder()
method) to create an instance of this struct.
Example
For example, let us use the example from section 5.2 of RFC 6749:
{
"error":"invalid_request"
}
Creating and serializing a simple error response telling the client their request was invalid would look like the following:
let error: ErrorResponse = ErrorResponse::builder()
.error(ErrorCode::InvalidRequest)
.build()?;
let mut serialized = Vec::new();
error.clone().serialize_into(&mut serialized)?;
assert_eq!(ErrorResponse::deserialize_from(serialized.as_slice())?, error);
Note that abbreviations aren’t used here, so keep in mind that the labels are really integers instead of strings. ↩
Fields§
§error: ErrorCode
§description: Option<String>
Human-readable ASCII text providing additional information, used to assist the client developer in understanding the error that occurred.
uri: Option<String>
A URI identifying a human-readable web page with information about the error, used to provide the client developer with additional information about the error.
Implementations§
source§impl ErrorResponse
impl ErrorResponse
sourcepub fn builder() -> ErrorResponseBuilder
pub fn builder() -> ErrorResponseBuilder
Initializes and returns a new ErrorResponseBuilder
.
Trait Implementations§
source§impl Clone for ErrorResponse
impl Clone for ErrorResponse
source§fn clone(&self) -> ErrorResponse
fn clone(&self) -> ErrorResponse
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for ErrorResponse
impl Debug for ErrorResponse
source§impl Hash for ErrorResponse
impl Hash for ErrorResponse
source§impl PartialEq<ErrorResponse> for ErrorResponse
impl PartialEq<ErrorResponse> for ErrorResponse
source§fn eq(&self, other: &ErrorResponse) -> bool
fn eq(&self, other: &ErrorResponse) -> bool
self
and other
values to be equal, and is used
by ==
.source§impl ToCborMap for ErrorResponse
impl ToCborMap for ErrorResponse
source§fn serialize_into<W>(self, writer: W) -> Result<(), Error<W::Error>>where
Self: Sized,
W: Write,
W::Error: Debug,
fn serialize_into<W>(self, writer: W) -> Result<(), Error<W::Error>>where Self: Sized, W: Write, W::Error: Debug,
writer
. Read moresource§fn deserialize_from<R>(reader: R) -> Result<Self, Error<R::Error>>where
Self: Sized,
R: Read,
R::Error: Debug,
fn deserialize_from<R>(reader: R) -> Result<Self, Error<R::Error>>where Self: Sized, R: Read, R::Error: Debug,
reader
— which is expected to be an instance of this type,
represented as a CBOR map bytestring — into an instance of this type. Read more