pub trait ErrorMetadata {
// Required method
fn code(&self) -> &'static str;
// Provided methods
fn description(&self) -> Option<&'static str> { ... }
fn hints(&self) -> &'static [&'static str] { ... }
fn role(&self) -> Role { ... }
fn docs_url(&self) -> Option<&'static str> { ... }
fn examples(&self) -> &'static [&'static str] { ... }
fn related_codes(&self) -> &'static [&'static str] { ... }
fn since_version(&self) -> Option<&'static str> { ... }
}Expand description
Full error metadata for advanced documentation generation
Implement this trait on specific error types to export complete error definitions to JSON/docs with all metadata.
§Examples
use waddling_errors::{ErrorMetadata, Role};
struct ParserSyntax001;
impl ErrorMetadata for ParserSyntax001 {
fn code(&self) -> &'static str {
"E.PARSER.SYNTAX.001"
}
fn description(&self) -> Option<&'static str> {
Some("Expected semicolon at end of statement")
}
fn hints(&self) -> &'static [&'static str] {
&["Add a semicolon after the statement"]
}
fn role(&self) -> Role {
Role::Public
}
}Required Methods§
Provided Methods§
Sourcefn description(&self) -> Option<&'static str>
fn description(&self) -> Option<&'static str>
Human-readable description
Related error codes
Sourcefn since_version(&self) -> Option<&'static str>
fn since_version(&self) -> Option<&'static str>
Version when this error was introduced