pub enum ApiError {
Configuration {
message: String,
},
Network {
message: String,
},
Protocol {
message: String,
},
Dialog {
message: String,
},
Internal {
message: String,
},
}
Expand description
Simplified error type for API consumers
Provides high-level error categories that applications can handle appropriately without needing to understand internal dialog-core details.
§Design Principles
- User-friendly: Clear, actionable error messages
- Categorized: Logical grouping for appropriate handling
- Abstracted: Hides internal implementation complexity
- Consistent: Uniform error handling across all APIs
§Error Categories
§Configuration Errors
Issues with setup, parameters, or invalid configurations:
- Invalid URIs or addresses
- Missing required parameters
- Incompatible configuration combinations
§Network Errors
Connectivity and transport-related issues:
- Connection failures
- Transport errors
- Timeout issues
§Protocol Errors
SIP protocol violations and parsing errors:
- Malformed SIP messages
- Protocol state violations
- Unsupported SIP features
§Dialog Errors
Dialog state and lifecycle issues:
- Dialog not found
- Invalid dialog state transitions
- Dialog termination errors
§Internal Errors
Implementation or system-level errors:
- Unexpected internal states
- System resource issues
- Programming errors
Variants§
Configuration
Configuration error
Indicates an issue with configuration parameters, setup, or initialization. These errors typically require user intervention to fix the configuration.
§Common Causes
- Invalid URI formats
- Missing required parameters
- Incompatible configuration options
- Invalid network addresses
§Example Response
Review and correct the configuration parameters.
Network
Network error
Indicates connectivity or transport-related issues. These errors may be transient and worth retrying.
§Common Causes
- Network connectivity issues
- Server unavailable
- Connection timeouts
- Transport layer failures
§Example Response
Check network connectivity and retry the operation.
Protocol
SIP protocol error
Indicates violations of the SIP protocol or parsing errors. These errors suggest malformed messages or protocol misuse.
§Common Causes
- Malformed SIP messages
- Invalid SIP headers
- Protocol state violations
- Unsupported SIP extensions
§Example Response
Review SIP message formatting and protocol compliance.
Dialog
Dialog error
Indicates issues with dialog state, lifecycle, or operations. These errors suggest problems with dialog management.
§Common Causes
- Dialog not found
- Invalid state transitions
- Dialog already terminated
- Concurrent access issues
§Example Response
Check dialog state and ensure proper lifecycle management.
Internal
Implementations§
Trait Implementations§
Source§impl Error for ApiError
impl Error for ApiError
1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
Source§impl From<AddrParseError> for ApiError
Convert from address parsing errors to ApiError
impl From<AddrParseError> for ApiError
Convert from address parsing errors to ApiError
Source§fn from(error: AddrParseError) -> Self
fn from(error: AddrParseError) -> Self
Source§impl From<DialogError> for ApiError
Convert from internal DialogError to public ApiError
impl From<DialogError> for ApiError
Convert from internal DialogError to public ApiError
This conversion abstracts internal error details and provides user-friendly error categories for API consumers.
Source§fn from(error: DialogError) -> Self
fn from(error: DialogError) -> Self
Source§impl From<InvalidUri> for ApiError
Convert from URI parsing errors to ApiError
impl From<InvalidUri> for ApiError
Convert from URI parsing errors to ApiError