pub struct ErrorObject {
pub error_type: String,
pub error_message: String,
pub stack_trace: Option<String>,
}Expand description
Error object for serialization in Lambda responses.
§Examples
use durable_execution_sdk::ErrorObject;
// Basic error object
let err = ErrorObject::new("ValidationError", "Invalid input");
assert_eq!(err.error_type, "ValidationError");
assert_eq!(err.error_message, "Invalid input");
assert!(err.stack_trace.is_none());
// With stack trace
let err_with_trace = ErrorObject::with_stack_trace(
"RuntimeError",
"Something went wrong",
"at main.rs:42"
);
assert!(err_with_trace.stack_trace.is_some());Serialization:
use durable_execution_sdk::ErrorObject;
let err = ErrorObject::new("TestError", "Test message");
let json = serde_json::to_string(&err).unwrap();
assert!(json.contains("ErrorType"));
assert!(json.contains("ErrorMessage"));Fields§
§error_type: StringThe error type/name
error_message: StringThe error message
stack_trace: Option<String>Optional stack trace
Implementations§
Source§impl ErrorObject
impl ErrorObject
Sourcepub fn new(
error_type: impl Into<String>,
error_message: impl Into<String>,
) -> ErrorObject
pub fn new( error_type: impl Into<String>, error_message: impl Into<String>, ) -> ErrorObject
Creates a new ErrorObject.
Sourcepub fn with_stack_trace(
error_type: impl Into<String>,
error_message: impl Into<String>,
stack_trace: impl Into<String>,
) -> ErrorObject
pub fn with_stack_trace( error_type: impl Into<String>, error_message: impl Into<String>, stack_trace: impl Into<String>, ) -> ErrorObject
Creates a new ErrorObject with a stack trace.
Trait Implementations§
Source§impl Clone for ErrorObject
impl Clone for ErrorObject
Source§fn clone(&self) -> ErrorObject
fn clone(&self) -> ErrorObject
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ErrorObject
impl Debug for ErrorObject
Source§impl<'de> Deserialize<'de> for ErrorObject
impl<'de> Deserialize<'de> for ErrorObject
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<ErrorObject, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<ErrorObject, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl From<&DurableError> for ErrorObject
impl From<&DurableError> for ErrorObject
Source§fn from(error: &DurableError) -> ErrorObject
fn from(error: &DurableError) -> ErrorObject
Converts to this type from the input type.
Source§impl From<ErrorObject> for TestResultError
impl From<ErrorObject> for TestResultError
Source§fn from(error: ErrorObject) -> Self
fn from(error: ErrorObject) -> Self
Converts to this type from the input type.
Source§impl Serialize for ErrorObject
impl Serialize for ErrorObject
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Serialize this value into the given Serde serializer. Read more
Auto Trait Implementations§
impl Freeze for ErrorObject
impl RefUnwindSafe for ErrorObject
impl Send for ErrorObject
impl Sync for ErrorObject
impl Unpin for ErrorObject
impl UnsafeUnpin for ErrorObject
impl UnwindSafe for ErrorObject
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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.