pub struct SsmError {
pub code: SsmErrorCode,
pub message: String,
pub status_code: StatusCode,
pub source: Option<Box<dyn Error + Send + Sync>>,
}Expand description
An SSM error response.
Fields§
§code: SsmErrorCodeThe error code.
message: StringA human-readable error message.
status_code: StatusCodeThe HTTP status code.
source: Option<Box<dyn Error + Send + Sync>>The underlying source error, if any.
Implementations§
Source§impl SsmError
impl SsmError
Sourcepub fn new(code: SsmErrorCode) -> Self
pub fn new(code: SsmErrorCode) -> Self
Create a new SsmError from an error code.
Sourcepub fn with_message(code: SsmErrorCode, message: impl Into<String>) -> Self
pub fn with_message(code: SsmErrorCode, message: impl Into<String>) -> Self
Create a new SsmError with a custom message.
Sourcepub fn with_source(self, source: impl Error + Send + Sync + 'static) -> Self
pub fn with_source(self, source: impl Error + Send + Sync + 'static) -> Self
Set the source error.
Sourcepub fn error_type(&self) -> &'static str
pub fn error_type(&self) -> &'static str
Returns the __type string for the JSON error response.
Sourcepub fn parameter_not_found(name: &str) -> Self
pub fn parameter_not_found(name: &str) -> Self
Parameter not found.
Sourcepub fn parameter_already_exists(name: &str) -> Self
pub fn parameter_already_exists(name: &str) -> Self
Parameter already exists.
Sourcepub fn validation(message: impl Into<String>) -> Self
pub fn validation(message: impl Into<String>) -> Self
Validation error.
Sourcepub fn internal_error(message: impl Into<String>) -> Self
pub fn internal_error(message: impl Into<String>) -> Self
Internal server error.
Sourcepub fn missing_action() -> Self
pub fn missing_action() -> Self
Missing action header.
Sourcepub fn unknown_operation(target: &str) -> Self
pub fn unknown_operation(target: &str) -> Self
Unknown operation.
Sourcepub fn not_implemented(operation: &str) -> Self
pub fn not_implemented(operation: &str) -> Self
Not implemented.
Trait Implementations§
Source§impl Error for SsmError
impl Error for SsmError
Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
👎Deprecated since 1.42.0:
use the Display impl or to_string()
Auto Trait Implementations§
impl Freeze for SsmError
impl !RefUnwindSafe for SsmError
impl Send for SsmError
impl Sync for SsmError
impl Unpin for SsmError
impl UnsafeUnpin for SsmError
impl !UnwindSafe for SsmError
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
Mutably borrows from an owned value. Read more