zksync_error/
documentation.rs1use core::fmt;
5use lazy_static::lazy_static;
6use zksync_error_description::ErrorHierarchy;
7lazy_static! {
8 pub static ref model: ErrorHierarchy = get_model();
9}
10fn get_model() -> ErrorHierarchy {
11 zksync_error_description::ErrorHierarchy::deserialize(include_str!(
12 "../resources/error-model-dump.json"
13 ))
14}
15#[derive(Debug)]
16pub enum DocumentationError {
17 IncompleteModel(String),
18}
19impl fmt::Display for DocumentationError {
20 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
21 f.write_fmt(format_args!("{self:#?}"))
22 }
23}
24impl core::error::Error for DocumentationError {}
25pub trait Documented {
26 type Documentation;
27 fn get_documentation(&self) -> Result<Option<Self::Documentation>, DocumentationError>;
28}