pub enum ProjectManagerError {
FileSystem {
operation: String,
path: PathBuf,
source: Error,
},
Serialization {
operation: String,
content: String,
source: Error,
},
Validation {
field: String,
value: String,
reason: String,
},
NotFound {
resource_type: String,
identifier: String,
context: Option<String>,
},
AlreadyExists {
resource_type: String,
identifier: String,
context: Option<String>,
},
McpProtocol {
operation: String,
details: String,
source: Option<Box<dyn Error + Send + Sync>>,
},
Configuration {
setting: String,
value: String,
reason: String,
},
Permission {
operation: String,
path: PathBuf,
details: String,
},
Internal {
operation: String,
details: String,
source: Option<Box<dyn Error + Send + Sync>>,
},
}
Expand description
Custom error types for different failure categories
Variants§
FileSystem
File system related errors
Serialization
JSON serialization/deserialization errors
Validation
Validation errors for user input
NotFound
Resource not found errors
AlreadyExists
Resource already exists errors
McpProtocol
MCP protocol errors
Configuration
Configuration errors
Permission
Permission errors
Internal
Internal errors (should not happen in normal operation)
Implementations§
Source§impl ProjectManagerError
impl ProjectManagerError
Sourcepub fn file_system_error(operation: &str, path: &Path, source: Error) -> Self
pub fn file_system_error(operation: &str, path: &Path, source: Error) -> Self
Create a file system error with context
Sourcepub fn serialization_error(
operation: &str,
content: &str,
source: Error,
) -> Self
pub fn serialization_error( operation: &str, content: &str, source: Error, ) -> Self
Create a serialization error with context
Sourcepub fn validation_error(field: &str, value: &str, reason: &str) -> Self
pub fn validation_error(field: &str, value: &str, reason: &str) -> Self
Create a validation error
Sourcepub fn not_found(
resource_type: &str,
identifier: &str,
context: Option<&str>,
) -> Self
pub fn not_found( resource_type: &str, identifier: &str, context: Option<&str>, ) -> Self
Create a not found error
Sourcepub fn already_exists(
resource_type: &str,
identifier: &str,
context: Option<&str>,
) -> Self
pub fn already_exists( resource_type: &str, identifier: &str, context: Option<&str>, ) -> Self
Create an already exists error
Sourcepub fn mcp_protocol_error(
operation: &str,
details: &str,
source: Option<Box<dyn Error + Send + Sync>>,
) -> Self
pub fn mcp_protocol_error( operation: &str, details: &str, source: Option<Box<dyn Error + Send + Sync>>, ) -> Self
Create an MCP protocol error
Sourcepub fn configuration_error(setting: &str, value: &str, reason: &str) -> Self
pub fn configuration_error(setting: &str, value: &str, reason: &str) -> Self
Create a configuration error
Sourcepub fn permission_error(operation: &str, path: &Path, details: &str) -> Self
pub fn permission_error(operation: &str, path: &Path, details: &str) -> Self
Create a permission error
Sourcepub fn internal_error(
operation: &str,
details: &str,
source: Option<Box<dyn Error + Send + Sync>>,
) -> Self
pub fn internal_error( operation: &str, details: &str, source: Option<Box<dyn Error + Send + Sync>>, ) -> Self
Create an internal error
Sourcepub fn user_message(&self) -> String
pub fn user_message(&self) -> String
Get a user-friendly error message with context
Sourcepub fn get_suggestion(&self) -> Option<String>
pub fn get_suggestion(&self) -> Option<String>
Get actionable suggestions for resolving the error
Sourcepub fn get_troubleshooting_steps(&self) -> Vec<String>
pub fn get_troubleshooting_steps(&self) -> Vec<String>
Get detailed troubleshooting steps
Sourcepub fn debug_message(&self) -> String
pub fn debug_message(&self) -> String
Get a detailed error message for developers
Sourcepub fn is_user_facing(&self) -> bool
pub fn is_user_facing(&self) -> bool
Check if this is a user-facing error (vs internal error)
Trait Implementations§
Source§impl Debug for ProjectManagerError
impl Debug for ProjectManagerError
Source§impl Display for ProjectManagerError
impl Display for ProjectManagerError
Source§impl Error for ProjectManagerError
impl Error for ProjectManagerError
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<Error> for ProjectManagerError
impl From<Error> for ProjectManagerError
Auto Trait Implementations§
impl Freeze for ProjectManagerError
impl !RefUnwindSafe for ProjectManagerError
impl Send for ProjectManagerError
impl Sync for ProjectManagerError
impl Unpin for ProjectManagerError
impl !UnwindSafe for ProjectManagerError
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> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<T> ToStringFallible for Twhere
T: Display,
impl<T> ToStringFallible for Twhere
T: Display,
Source§fn try_to_string(&self) -> Result<String, TryReserveError>
fn try_to_string(&self) -> Result<String, TryReserveError>
ToString::to_string
, but without panic on OOM.