Skip to main content

Error

Enum Error 

Source
#[non_exhaustive]
pub enum Error {
Show 13 variants BaseUrl { base: Url, }, ClientBuild { source: Error, }, RequestBody { operation: &'static str, source: Error, }, UnsupportedParameter { operation: &'static str, parameter: &'static str, wire_version: WireVersion, }, Transport { url: Url, source: Error, }, Timeout { url: Url, source: Error, }, ServerFailure { url: Url, upstream: Box<UpstreamError>, }, Unauthorized { url: Url, challenge: Option<String>, upstream: Box<UpstreamError>, }, Token { url: Url, source: TokenFailure, }, Renewal { url: Url, upstream: Box<UpstreamError>, source: TokenFailure, }, Refused { operation: &'static str, url: Url, upstream: Box<UpstreamError>, }, Body { operation: &'static str, url: Url, source: Box<BodyError>, }, BatchArity { sent: usize, answered: usize, },
}
Expand description

A call into the terminology server that did not reach an answer.

Variants (Non-exhaustive)§

This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

BaseUrl

The request could not be built into a URL under the configured base.

Fields

§base: Url

The configured base URL.

§

ClientBuild

The HTTP client could not be built from the configuration.

Fields

§source: Error

What the HTTP stack reported.

§

RequestBody

A request body could not be written as FHIR JSON.

Fields

§operation: &'static str

The operation, as Resource/$code.

§source: Error

What the encoder reported.

§

UnsupportedParameter

The request carries a parameter the configured release’s OperationDefinition does not declare and has no equivalent for, so nothing was sent.

STU3 ConceptMap/$translate has no url, and STU3 ValueSet/$validate-code has no valueSetVersion (https://hl7.org/fhir/STU3/terminology-service.html). Sending the request without the parameter would ask the server a different question than the caller asked.

Fields

§operation: &'static str

The operation, as Resource/$code.

§parameter: &'static str

The parameter, as the R4 OperationDefinition names it.

§wire_version: WireVersion

The release the client is configured for.

§

Transport

The request never reached the server.

Fields

§url: Url

The URL that was called.

§source: Error

What the HTTP stack reported.

§

Timeout

The server did not answer inside the configured timeout.

Fields

§url: Url

The URL that was called.

§source: Error

What the HTTP stack reported.

§

ServerFailure

The server answered 5xx.

Fields

§url: Url

The URL that was called.

§upstream: Box<UpstreamError>

The upstream status and body.

§

Unauthorized

The server refused the credentials.

Fields

§url: Url

The URL that was called.

§challenge: Option<String>

The WWW-Authenticate challenge, when the server sent one.

§upstream: Box<UpstreamError>

The upstream status and body.

§

Token

The token provider obtained no token, so nothing was sent.

Fields

§url: Url

The URL the request was for.

§source: TokenFailure

The provider’s failure.

§

Renewal

The server refused the token (401) and no new one could be obtained, so the request was not sent again.

Fields

§url: Url

The URL that was called.

§upstream: Box<UpstreamError>

The upstream status and body of the refusal.

§source: TokenFailure

The provider’s failure.

§

Refused

The server refused the operation.

Fields

§operation: &'static str

The operation, as Resource/$code.

§url: Url

The URL that was called.

§upstream: Box<UpstreamError>

The upstream status and body, with any tx-issue-type coding.

§

Body

The response body could not be decoded.

Fields

§operation: &'static str

The operation, as Resource/$code.

§url: Url

The URL that was called.

§source: Box<BodyError>

What the decoder reported.

§

BatchArity

The batch answered a different number of entries than were sent.

Fields

§sent: usize

How many requests were sent.

§answered: usize

How many entries came back.

Implementations§

Source§

impl Error

Source

pub fn kind(&self) -> &'static str

Returns the variant’s name as a short kebab-case label, for a log line that must name the failure class and never the URL or a body.

Source

pub fn upstream_status(&self) -> Option<StatusCode>

Returns the status the terminology server answered with, when the failure is an answer: a 5xx, a refused credential or a refused operation. A call that never reached an answer has none.

Source

pub fn is_retryable(&self) -> bool

Returns whether a retry of the same request could succeed.

Only a failure that did not reach the server, or one the server reported as its own (5xx), is transient. The three operations declare affectsState: false (OperationDefinition-CodeSystem-lookup, OperationDefinition-ConceptMap-translate and OperationDefinition-ValueSet-validate-code, R4B), so a repeat is the same read and the POST form is retried like the GET form (https://hl7.org/fhir/R4/operations.html). The STU3 definitions of the same operations declare no such flag; retrying them on the same ground is our own design.

Trait Implementations§

Source§

impl Debug for Error

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Display for Error

Source§

fn fmt(&self, __formatter: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Error for Error

Source§

fn source(&self) -> Option<&(dyn Error + 'static)>

Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§

fn description(&self) -> &str

👎Deprecated since 1.42.0:

use the Display impl or to_string()

1.0.0 · Source§

fn cause(&self) -> Option<&dyn Error>

👎Deprecated since 1.33.0:

replaced by Error::source, which can support downcasting

Source§

fn provide<'a>(&'a self, request: &mut Request<'a>)

🔬This is a nightly-only experimental API. (error_generic_member_access)
Provides type-based access to context intended for error reports. Read more

Auto Trait Implementations§

§

impl !RefUnwindSafe for Error

§

impl !UnwindSafe for Error

§

impl Freeze for Error

§

impl Send for Error

§

impl Sync for Error

§

impl Unpin for Error

§

impl UnsafeUnpin for Error

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more