fetchlet_web/error.rs
1/// A failed Web API operation. Embedders map each kind onto their own
2/// guest-visible error codes.
3#[derive(Debug, thiserror::Error)]
4pub enum Error {
5 /// The message does not match the operation's protocol.
6 #[error("invalid request: {0}")]
7 InvalidRequest(String),
8 /// A caller budget in [`WebLimits`](crate::WebLimits) or a limit of the
9 /// specification was exceeded.
10 #[error("resource limit exceeded: {0}")]
11 LimitExceeded(&'static str),
12 /// The operation does not exist in this build.
13 #[error("unknown Web API operation")]
14 UnknownOperation,
15 /// The operation keeps per-invocation state and no invocation is active.
16 #[error("the operation needs an active invocation")]
17 NoInvocation,
18 /// A system facility, such as the random source, failed.
19 #[error("unavailable: {0}")]
20 Unavailable(&'static str),
21}
22
23pub type Result<T, E = Error> = std::result::Result<T, E>;