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