ate_crypto/error/
serialization_error.rs

1use error_chain::error_chain;
2use rmp_serde::decode::Error as RmpDecodeError;
3use rmp_serde::encode::Error as RmpEncodeError;
4use serde_json::Error as JsonError;
5
6use crate::spec::PrimaryKey;
7pub use wasmer_bus_types::BusError;
8
9error_chain! {
10    types {
11        SerializationError, SerializationErrorKind, ResultExt, Result;
12    }
13    links {
14    }
15    foreign_links {
16        IO(tokio::io::Error);
17        EncodeError(RmpEncodeError);
18        DecodeError(RmpDecodeError);
19        JsonError(JsonError);
20        BincodeError(bincode::Error);
21        Base64Error(base64::DecodeError);
22        BusError(BusError);
23    }
24    errors {
25        NoPrimarykey {
26            description("data object does not have a primary key")
27            display("data object does not have a primary key")
28        }
29        NoData {
30            description("data object has no actual data")
31            display("data object has no actual data")
32        }
33        MissingData {
34            description("the data for this record is missing")
35            display("the data for this record is missing")
36        }
37        InvalidSerializationFormat {
38            description("data is stored in an unknown serialization format")
39            display("data is stored in an unknown serialization format")
40        }
41        CollectionDetached {
42            description("collection is detached from a parent")
43            display("collection is detached from a parent")
44        }
45        SerdeError(err: String) {
46            description("serde error during serialization"),
47            display("serde error during serialization - {}", err),
48        }
49        WeakDio {
50            description("the dio that created this object has gone out of scope")
51            display("the dio that created this object has gone out of scope")
52        }
53        SaveParentFirst {
54            description("you must save the parent object before attempting to push objects to this vector")
55            display("you must save the parent object before attempting to push objects to this vector")
56        }
57        ObjectStillLocked(key: PrimaryKey) {
58            description("data object with key is still being edited in the current scope"),
59            display("data object with key ({}) is still being edited in the current scope", key.as_hex_string()),
60        }
61        AlreadyDeleted(key: PrimaryKey) {
62            description("data object with key has already been deleted"),
63            display("data object with key ({}) has already been deleted", key.as_hex_string()),
64        }
65    }
66}