pub enum Error {
Http(String),
Status {
status: u16,
message: String,
},
Decode(String),
DuplicateQuestion(String),
Invalid {
id: String,
why: String,
},
MissingAnswer(String),
WrongType {
id: String,
expected: &'static str,
found: String,
},
MissingProbability {
id: String,
label: String,
},
}Expand description
Errors are kept as owned data so they stay Send + Sync on wasm32, where the
underlying fetch errors are not.
Variants§
Http(String)
The request could not be sent or its reply could not be read.
Status
The endpoint answered with a non-success status; message is its error message, or the start
of the body when it has none.
Decode(String)
A request could not be encoded or a reply could not be decoded.
DuplicateQuestion(String)
The same question id was given twice, so one question would have replaced the other.
Invalid
A question cannot be answered as asked: too many options, an option twice, no levels.
MissingAnswer(String)
The reply has no answer under this question id.
WrongType
The answer under id is of another type than the one asked for.
MissingProbability
The answer under id gives no probability for one of its levels or options, which rules
need: reading it as zero would be a confident no that nothing said.
Trait Implementations§
Source§impl Error for Error
impl Error for Error
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()