pub struct TokmdError {
pub code: ErrorCode,
pub message: String,
pub details: Option<String>,
pub suggestions: Option<Vec<String>>,
}Expand description
Structured error for FFI-friendly error reporting.
Fields§
§code: ErrorCodeError code for programmatic handling.
message: StringHuman-readable error message.
details: Option<String>Optional additional details.
suggestions: Option<Vec<String>>Optional helpful suggestions for resolving the error.
Implementations§
Source§impl TokmdError
impl TokmdError
Sourcepub fn new(code: ErrorCode, message: impl Into<String>) -> Self
pub fn new(code: ErrorCode, message: impl Into<String>) -> Self
Create a new error with given code and message.
Sourcepub fn with_details(
code: ErrorCode,
message: impl Into<String>,
details: impl Into<String>,
) -> Self
pub fn with_details( code: ErrorCode, message: impl Into<String>, details: impl Into<String>, ) -> Self
Create an error with additional details.
Sourcepub fn with_suggestions(
code: ErrorCode,
message: impl Into<String>,
suggestions: Vec<String>,
) -> Self
pub fn with_suggestions( code: ErrorCode, message: impl Into<String>, suggestions: Vec<String>, ) -> Self
Create an error with suggestions.
Sourcepub fn with_details_and_suggestions(
code: ErrorCode,
message: impl Into<String>,
details: impl Into<String>,
suggestions: Vec<String>,
) -> Self
pub fn with_details_and_suggestions( code: ErrorCode, message: impl Into<String>, details: impl Into<String>, suggestions: Vec<String>, ) -> Self
Create an error with both details and suggestions.
Sourcepub fn git_not_available() -> Self
pub fn git_not_available() -> Self
Create a git not available error.
Sourcepub fn not_git_repository(path: &str) -> Self
pub fn not_git_repository(path: &str) -> Self
Create a not git repository error.
Sourcepub fn git_operation_failed(operation: &str, reason: &str) -> Self
pub fn git_operation_failed(operation: &str, reason: &str) -> Self
Create a git operation failed error.
Sourcepub fn config_not_found(path: &str) -> Self
pub fn config_not_found(path: &str) -> Self
Create a config not found error.
Sourcepub fn config_invalid(path: &str, reason: &str) -> Self
pub fn config_invalid(path: &str, reason: &str) -> Self
Create a config invalid error.
Sourcepub fn path_not_found_with_suggestions(path: &str) -> Self
pub fn path_not_found_with_suggestions(path: &str) -> Self
Create a path not found error with suggestions.
Sourcepub fn path_not_found(path: &str) -> Self
pub fn path_not_found(path: &str) -> Self
Create a path not found error.
Sourcepub fn invalid_json(err: impl Display) -> Self
pub fn invalid_json(err: impl Display) -> Self
Create an invalid JSON error.
Sourcepub fn unknown_mode(mode: &str) -> Self
pub fn unknown_mode(mode: &str) -> Self
Create an unknown mode error.
Sourcepub fn scan_error(err: impl Display) -> Self
pub fn scan_error(err: impl Display) -> Self
Create a scan error from an anyhow error.
Sourcepub fn analysis_error(err: impl Display) -> Self
pub fn analysis_error(err: impl Display) -> Self
Create an analysis error from an anyhow error.
Sourcepub fn not_implemented(feature: impl Into<String>) -> Self
pub fn not_implemented(feature: impl Into<String>) -> Self
Create a not implemented error.
Sourcepub fn invalid_field(field: &str, expected: &str) -> Self
pub fn invalid_field(field: &str, expected: &str) -> Self
Create an invalid settings error for a specific field.
Trait Implementations§
Source§impl Clone for TokmdError
impl Clone for TokmdError
Source§fn clone(&self) -> TokmdError
fn clone(&self) -> TokmdError
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for TokmdError
impl Debug for TokmdError
Source§impl<'de> Deserialize<'de> for TokmdError
impl<'de> Deserialize<'de> for TokmdError
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl Display for TokmdError
impl Display for TokmdError
Source§impl Error for TokmdError
impl Error for TokmdError
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
use the Display impl or to_string()
Source§impl From<&TokmdError> for ErrorDetails
impl From<&TokmdError> for ErrorDetails
Source§fn from(err: &TokmdError) -> Self
fn from(err: &TokmdError) -> Self
Source§impl From<Error> for TokmdError
impl From<Error> for TokmdError
Source§impl From<Error> for TokmdError
impl From<Error> for TokmdError
Source§impl From<Error> for TokmdError
impl From<Error> for TokmdError
Source§impl From<TokmdError> for ErrorResponse
impl From<TokmdError> for ErrorResponse
Source§fn from(err: TokmdError) -> Self
fn from(err: TokmdError) -> Self
Auto Trait Implementations§
impl Freeze for TokmdError
impl RefUnwindSafe for TokmdError
impl Send for TokmdError
impl Sync for TokmdError
impl Unpin for TokmdError
impl UnsafeUnpin for TokmdError
impl UnwindSafe for TokmdError
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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