pub enum McpError {
Show 17 variants
ToolNotFound {
tool_name: String,
},
ResourceNotFound {
uri: String,
},
PromptNotFound {
prompt_name: String,
},
InvalidParameter {
parameter_name: String,
message: String,
},
MissingParameter {
parameter_name: String,
},
InvalidFormat {
format: String,
supported: String,
},
InvalidDataType {
data_type: String,
supported: String,
},
DatabaseOperationFailed {
operation: String,
source: ThingsError,
},
BackupOperationFailed {
operation: String,
source: ThingsError,
},
ExportOperationFailed {
operation: String,
source: ThingsError,
},
PerformanceMonitoringFailed {
operation: String,
source: ThingsError,
},
CacheOperationFailed {
operation: String,
source: ThingsError,
},
SerializationFailed {
operation: String,
source: Error,
},
IoOperationFailed {
operation: String,
source: Error,
},
ConfigurationError {
message: String,
},
ValidationError {
message: String,
},
InternalError {
message: String,
},
}Expand description
MCP-specific error types for better error handling and user experience
Variants§
ToolNotFound
ResourceNotFound
PromptNotFound
InvalidParameter
MissingParameter
InvalidFormat
InvalidDataType
DatabaseOperationFailed
BackupOperationFailed
ExportOperationFailed
PerformanceMonitoringFailed
CacheOperationFailed
SerializationFailed
IoOperationFailed
ConfigurationError
ValidationError
InternalError
Implementations§
Source§impl McpError
impl McpError
Sourcepub fn tool_not_found(tool_name: impl Into<String>) -> Self
pub fn tool_not_found(tool_name: impl Into<String>) -> Self
Create a tool not found error
Sourcepub fn resource_not_found(uri: impl Into<String>) -> Self
pub fn resource_not_found(uri: impl Into<String>) -> Self
Create a resource not found error
Sourcepub fn prompt_not_found(prompt_name: impl Into<String>) -> Self
pub fn prompt_not_found(prompt_name: impl Into<String>) -> Self
Create a prompt not found error
Sourcepub fn invalid_parameter(
parameter_name: impl Into<String>,
message: impl Into<String>,
) -> Self
pub fn invalid_parameter( parameter_name: impl Into<String>, message: impl Into<String>, ) -> Self
Create an invalid parameter error
Sourcepub fn missing_parameter(parameter_name: impl Into<String>) -> Self
pub fn missing_parameter(parameter_name: impl Into<String>) -> Self
Create a missing parameter error
Sourcepub fn invalid_format(
format: impl Into<String>,
supported: impl Into<String>,
) -> Self
pub fn invalid_format( format: impl Into<String>, supported: impl Into<String>, ) -> Self
Create an invalid format error
Sourcepub fn invalid_data_type(
data_type: impl Into<String>,
supported: impl Into<String>,
) -> Self
pub fn invalid_data_type( data_type: impl Into<String>, supported: impl Into<String>, ) -> Self
Create an invalid data type error
Sourcepub fn database_operation_failed(
operation: impl Into<String>,
source: ThingsError,
) -> Self
pub fn database_operation_failed( operation: impl Into<String>, source: ThingsError, ) -> Self
Create a database operation failed error
Sourcepub fn backup_operation_failed(
operation: impl Into<String>,
source: ThingsError,
) -> Self
pub fn backup_operation_failed( operation: impl Into<String>, source: ThingsError, ) -> Self
Create a backup operation failed error
Sourcepub fn export_operation_failed(
operation: impl Into<String>,
source: ThingsError,
) -> Self
pub fn export_operation_failed( operation: impl Into<String>, source: ThingsError, ) -> Self
Create an export operation failed error
Sourcepub fn performance_monitoring_failed(
operation: impl Into<String>,
source: ThingsError,
) -> Self
pub fn performance_monitoring_failed( operation: impl Into<String>, source: ThingsError, ) -> Self
Create a performance monitoring failed error
Sourcepub fn cache_operation_failed(
operation: impl Into<String>,
source: ThingsError,
) -> Self
pub fn cache_operation_failed( operation: impl Into<String>, source: ThingsError, ) -> Self
Create a cache operation failed error
Sourcepub fn serialization_failed(operation: impl Into<String>, source: Error) -> Self
pub fn serialization_failed(operation: impl Into<String>, source: Error) -> Self
Create a serialization failed error
Sourcepub fn io_operation_failed(operation: impl Into<String>, source: Error) -> Self
pub fn io_operation_failed(operation: impl Into<String>, source: Error) -> Self
Create an IO operation failed error
Sourcepub fn configuration_error(message: impl Into<String>) -> Self
pub fn configuration_error(message: impl Into<String>) -> Self
Create a configuration error
Sourcepub fn validation_error(message: impl Into<String>) -> Self
pub fn validation_error(message: impl Into<String>) -> Self
Create a validation error
Sourcepub fn internal_error(message: impl Into<String>) -> Self
pub fn internal_error(message: impl Into<String>) -> Self
Create an internal error
Sourcepub fn to_call_result(self) -> CallToolResult
pub fn to_call_result(self) -> CallToolResult
Convert error to MCP call result
Sourcepub fn to_prompt_result(self) -> GetPromptResult
pub fn to_prompt_result(self) -> GetPromptResult
Convert error to MCP prompt result
Sourcepub fn to_resource_result(self) -> ReadResourceResult
pub fn to_resource_result(self) -> ReadResourceResult
Convert error to MCP resource result
Trait Implementations§
Source§impl Error for McpError
impl Error for McpError
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<MiddlewareError> for McpError
impl From<MiddlewareError> for McpError
Source§fn from(error: MiddlewareError) -> Self
fn from(error: MiddlewareError) -> Self
Source§impl From<ThingsError> for McpError
From trait implementations for common error types
impl From<ThingsError> for McpError
From trait implementations for common error types
Source§fn from(error: ThingsError) -> Self
fn from(error: ThingsError) -> Self
Auto Trait Implementations§
impl Freeze for McpError
impl !RefUnwindSafe for McpError
impl Send for McpError
impl Sync for McpError
impl Unpin for McpError
impl !UnwindSafe for McpError
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more