pub struct CasterHttpError {
pub status: StatusCode,
pub body: String,
}Expand description
An error reply from the NTRIP caster.
Returned inside the eyre::Report from RobustNtripClient::new when the
caster rejects the request with a status this crate does not retry, so a
caller can recover the caster’s own explanation rather than only a status
code:
if let Err(report) = robust_ntrip_client::RobustNtripClient::new("ntrip://host/mp", opts).await
&& let Some(caster) = report.downcast_ref::<robust_ntrip_client::CasterHttpError>()
{
eprintln!("caster said {}: {}", caster.status, caster.body);
}RTCM’s client guidance (2023-SC104-1344, p13) asks for exactly this: the
reply is “generally followed by a single line providing further details” and
that text “should be shown to the device user if at all possible”. The same
value is also attached as the source of the give-up error after
MAX_CONNECT_ATTEMPTS failures, so the last thing the caster said survives
there too.
Fields§
§status: StatusCodeThe status the caster replied with.
body: StringThe body of the reply, as received, truncated to
ERROR_BODY_MAX_CHARS. Usually one line of plain ASCII, but some
casters send HTML; CasterHttpError’s Display tidies it, this field
does not. Empty if the caster sent no body or it could not be read.
Trait Implementations§
Source§impl Clone for CasterHttpError
impl Clone for CasterHttpError
Source§fn clone(&self) -> CasterHttpError
fn clone(&self) -> CasterHttpError
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for CasterHttpError
impl Debug for CasterHttpError
Source§impl Display for CasterHttpError
impl Display for CasterHttpError
Source§impl Error for CasterHttpError
impl Error for CasterHttpError
1.30.0 · 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()