#[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
BaseUrl
The request could not be built into a URL under the configured base.
ClientBuild
The HTTP client could not be built from the configuration.
RequestBody
A request body could not be written as FHIR JSON.
Fields
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
wire_version: WireVersionThe release the client is configured for.
Transport
The request never reached the server.
Timeout
The server did not answer inside the configured timeout.
ServerFailure
The server answered 5xx.
The server refused the credentials.
Fields
The URL that was called.
The WWW-Authenticate challenge, when the server sent one.
The upstream status and body.
Token
The token provider obtained no token, so nothing was sent.
Renewal
The server refused the token (401) and no new one could be
obtained, so the request was not sent again.
Fields
upstream: Box<UpstreamError>The upstream status and body of the refusal.
source: TokenFailureThe provider’s failure.
Refused
The server refused the operation.
Fields
upstream: Box<UpstreamError>The upstream status and body, with any tx-issue-type coding.
Body
The response body could not be decoded.
Fields
BatchArity
The batch answered a different number of entries than were sent.
Implementations§
Source§impl Error
impl Error
Sourcepub fn kind(&self) -> &'static str
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.
Sourcepub fn upstream_status(&self) -> Option<StatusCode>
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.
Sourcepub fn is_retryable(&self) -> bool
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 Error for Error
impl Error for Error
Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()