SnmpKit.SnmpLib.MIB.Error (snmpkit v0.6.3)
Enhanced error handling with recovery and detailed diagnostics.
Provides structured error reporting with context, suggestions, and precise location information for MIB compilation errors.
Summary
Functions
Format an error for display with optional color coding.
Create a new error with detailed context and suggestions.
Types
@type error_type() ::
:syntax_error
| :semantic_error
| :import_error
| :type_error
| :constraint_error
| :duplicate_definition
| :file_not_found
| :unterminated_string
| :unexpected_token
| :unexpected_eof
| :invalid_number
| :invalid_identifier
Functions
Format an error for display with optional color coding.
Examples
iex> error = SnmpKit.SnmpLib.MIB.Error.new(:syntax_error, line: 42, column: 10)
iex> SnmpKit.SnmpLib.MIB.Error.format(error)
"Error at line 42, column 10: Syntax error"
@spec new( error_type(), keyword() ) :: t()
Create a new error with detailed context and suggestions.
Examples
iex> SnmpKit.SnmpLib.MIB.Error.new(:unexpected_token,
...> expected: :max_access,
...> actual: :access,
...> line: 42,
...> column: 10
...> )
%SnmpKit.SnmpLib.MIB.Error{
type: :unexpected_token,
message: "Expected max_access, but found access",
suggestions: ["Did you mean 'MAX-ACCESS' instead of 'ACCESS'?"]
}