dusk_data_driver/
error.rs1use alloc::string::{String, ToString};
10use core::fmt;
11
12#[derive(Debug, Clone, PartialEq)]
14pub enum Error {
15 Rkyv(String),
17 Json(String),
19 Unsupported(String),
21 Other(String),
23 #[cfg(feature = "reader")]
25 WasmRuntime(String),
26 #[cfg(feature = "reader")]
28 WasmMemory(String),
29 #[cfg(feature = "reader")]
31 WasmExport(String),
32 #[cfg(feature = "reader")]
34 FfiError(String),
35}
36
37impl fmt::Display for Error {
38 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
39 write!(f, "Data-Driver Error: {:?}", &self)
40 }
41}
42
43impl From<serde_json::Error> for Error {
44 fn from(value: serde_json::Error) -> Self {
45 Self::Json(value.to_string())
46 }
47}