pub struct ApiGatewayV2Error {
pub code: ApiGatewayV2ErrorCode,
pub message: String,
pub status_code: StatusCode,
pub source: Option<Box<dyn Error + Send + Sync>>,
}Expand description
An ApiGatewayV2 error response.
Fields§
§code: ApiGatewayV2ErrorCodeThe 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 ApiGatewayV2Error
impl ApiGatewayV2Error
Sourcepub fn new(code: ApiGatewayV2ErrorCode) -> Self
pub fn new(code: ApiGatewayV2ErrorCode) -> Self
Create a new ApiGatewayV2Error from an error code.
Sourcepub fn with_message(
code: ApiGatewayV2ErrorCode,
message: impl Into<String>,
) -> Self
pub fn with_message( code: ApiGatewayV2ErrorCode, message: impl Into<String>, ) -> Self
Create a new ApiGatewayV2Error with a custom message.
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 internal_error(message: impl Into<String>) -> Self
pub fn internal_error(message: impl Into<String>) -> Self
Internal error.
Sourcepub fn unknown_operation(method: &Method, path: &str) -> Self
pub fn unknown_operation(method: &Method, path: &str) -> Self
Unknown operation error.
Sourcepub fn not_implemented(operation: &str) -> Self
pub fn not_implemented(operation: &str) -> Self
Not implemented.
Trait Implementations§
Source§impl Debug for ApiGatewayV2Error
impl Debug for ApiGatewayV2Error
Source§impl Display for ApiGatewayV2Error
impl Display for ApiGatewayV2Error
Source§impl Error for ApiGatewayV2Error
impl Error for ApiGatewayV2Error
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 ApiGatewayV2Error
impl !RefUnwindSafe for ApiGatewayV2Error
impl Send for ApiGatewayV2Error
impl Sync for ApiGatewayV2Error
impl Unpin for ApiGatewayV2Error
impl UnsafeUnpin for ApiGatewayV2Error
impl !UnwindSafe for ApiGatewayV2Error
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