gesha_core/conversions/
error.rs

1use openapi_types::v3_0::OpenApiDataType;
2
3pub type Result<A> = std::result::Result<A, Error>;
4
5#[derive(Debug)]
6pub enum Error {
7    /// ## Client Error
8    /// e.g. a reference to a schema that does not exist.
9    ReferenceObjectNotFound(String),
10
11    /// ## Client Error
12    /// e.g. a schema with an unknown format.
13    UnknownFormat {
14        data_type: OpenApiDataType,
15        format: String,
16    },
17
18    /// ## Internal Error
19    /// e.g. a shape that has not been processed.
20    TransformBroken { detail: String },
21}
22
23#[macro_export]
24macro_rules! broken {
25    ($shape: expr) => {
26        $crate::conversions::Error::TransformBroken {
27            detail: format!(
28                "unprocessed shape found:\n  at {file}:{line}\n{shape:#?}",
29                file = file!(),
30                line = line!(),
31                shape = $shape,
32            ),
33        }
34    };
35}