pub struct AppsyncError {
pub error_type: String,
pub error_message: String,
}
Expand description
Error type for AWS AppSync operations
Multiple errors can be combined in one using the pipe operator
§Example
let combined_error = AppsyncError::new("ValidationError", "Email address is invalid") | AppsyncError::new("DatabaseError", "User not found in database");
// error_type: "ValidationError|DatabaseError"
// error_message: "Email address is invalid\nUser not found in database"
Can be created from any AWS SDK error or directly by the user.
§Example
struct Item {
id: u64,
data: String
}
async fn store_item(item: Item, client: &aws_sdk_dynamodb::Client) -> Result<(), AppsyncError> {
client.put_item()
.table_name("my-table")
.item("id", AttributeValue::N(item.id.to_string()))
.item("data", AttributeValue::S(item.data))
.send()
.await?;
Ok(())
}
Fields§
§error_type: String
The type/category of error that occurred (e.g. “ValidationError”, “NotFound”, “DatabaseError”)
error_message: String
A detailed message describing the specific error condition
Implementations§
Trait Implementations§
Source§impl BitOr for AppsyncError
impl BitOr for AppsyncError
Source§impl Debug for AppsyncError
impl Debug for AppsyncError
Source§impl Display for AppsyncError
impl Display for AppsyncError
Source§impl Error for AppsyncError
impl Error for AppsyncError
1.30.0 · 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()
Source§impl From<AppsyncError> for AppsyncResponse
impl From<AppsyncError> for AppsyncResponse
Source§fn from(value: AppsyncError) -> Self
fn from(value: AppsyncError) -> Self
Converts to this type from the input type.
Source§impl<T: ProvideErrorMetadata> From<T> for AppsyncError
impl<T: ProvideErrorMetadata> From<T> for AppsyncError
Auto Trait Implementations§
impl Freeze for AppsyncError
impl RefUnwindSafe for AppsyncError
impl Send for AppsyncError
impl Sync for AppsyncError
impl Unpin for AppsyncError
impl UnwindSafe for AppsyncError
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
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>
Converts
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>
Converts
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 moreSource§impl<B> IntoFunctionResponse<B, Body> for Bwhere
B: Serialize,
impl<B> IntoFunctionResponse<B, Body> for Bwhere
B: Serialize,
Source§fn into_response(self) -> FunctionResponse<B, Body>
fn into_response(self) -> FunctionResponse<B, Body>
Convert the type into a FunctionResponse.
Creates a shared type from an unshared type.