zerodds_corba_rust/
error.rs1use core::fmt;
6
7#[derive(Debug, Clone, PartialEq, Eq)]
9pub enum CorbaRustError {
10 Unsupported {
12 what: &'static str,
14 at: usize,
16 },
17 UnresolvedType {
19 scoped: String,
21 },
22 DataType(zerodds_idl_rust::RustGenError),
24}
25
26impl fmt::Display for CorbaRustError {
27 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
28 match self {
29 Self::Unsupported { what, at } => {
30 write!(
31 f,
32 "corba-rust-codegen: unsupported IDL construct `{what}` at offset {at}"
33 )
34 }
35 Self::UnresolvedType { scoped } => {
36 write!(f, "corba-rust-codegen: unresolved type `{scoped}`")
37 }
38 Self::DataType(e) => write!(f, "corba-rust-codegen: data-type emit failed: {e}"),
39 }
40 }
41}
42
43impl std::error::Error for CorbaRustError {}
44
45impl From<zerodds_idl_rust::RustGenError> for CorbaRustError {
46 fn from(e: zerodds_idl_rust::RustGenError) -> Self {
47 Self::DataType(e)
48 }
49}
50
51pub type Result<T> = core::result::Result<T, CorbaRustError>;