arvo_client/error.rs
1use serde::{Serialize, Serializer};
2
3/// What a front end shows when a call did not do what was asked.
4///
5/// One variant, carrying the engine's own words: the status message from a
6/// refused call, or what went wrong before one could be made. Serialises as
7/// a plain string, because that is what a front end can render.
8#[derive(Debug, thiserror::Error)]
9pub enum CommandError {
10 /// What went wrong, in the engine's words or this side's.
11 #[error("{0}")]
12 Failed(String),
13}
14
15impl Serialize for CommandError {
16 fn serialize<S: Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {
17 serializer.serialize_str(&self.to_string())
18 }
19}