Skip to main content

Failure

Struct Failure 

Source
pub struct Failure {
    pub message: String,
    pub source: String,
    pub stack_trace: String,
    pub encoded_attributes: Option<Payload>,
    pub cause: Option<Box<Failure>>,
    pub failure_info: Option<FailureInfo>,
}

Fields§

§message: String§source: String

The source this Failure originated in, e.g. TypeScriptSDK / JavaSDK In some SDKs this is used to rehydrate the stack trace into an exception object.

§stack_trace: String§encoded_attributes: Option<Payload>

Alternative way to supply message and stack_trace and possibly other attributes, used for encryption of errors originating in user code which might contain sensitive information. The encoded_attributes Payload could represent any serializable object, e.g. JSON object or a Failure proto message.

SDK authors:

  • The SDK should provide a default encodeFailureAttributes and decodeFailureAttributes implementation that:

    • Uses a JSON object to represent { message, stack_trace }.
    • Overwrites the original message with “Encoded failure” to indicate that more information could be extracted.
    • Overwrites the original stack_trace with an empty string.
    • The resulting JSON object is converted to Payload using the default PayloadConverter and should be processed by the user-provided PayloadCodec
  • If there’s demand, we could allow overriding the default SDK implementation to encode other opaque Failure attributes. (– api-linter: core::0203::optional=disabled –)

§cause: Option<Box<Failure>>§failure_info: Option<FailureInfo>

Implementations§

Source§

impl Failure

Source

pub fn is_timeout(&self) -> Option<TimeoutType>

Source

pub fn application_failure(message: String, non_retryable: bool) -> Self

Source

pub fn application_failure_from_error(ae: Error, non_retryable: bool) -> Self

Source

pub fn timeout(timeout_type: TimeoutType) -> Self

Source

pub fn maybe_application_failure(&self) -> Option<&ApplicationFailureInfo>

Extracts an ApplicationFailureInfo from a Failure instance if it exists

Source

pub fn is_benign_application_failure(&self) -> bool

Trait Implementations§

Source§

impl Clone for Failure

Source§

fn clone(&self) -> Failure

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Failure

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for Failure

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
§

impl<'de> Deserialize<'de> for Failure

§

fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Display for Failure

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl From<&str> for Failure

Source§

fn from(v: &str) -> Self

Converts to this type from the input type.
Source§

impl From<Error> for Failure

Source§

fn from(ae: Error) -> Self

Converts to this type from the input type.
Source§

impl From<Failure> for Failure

Source§

fn from(f: Failure) -> Self

Converts to this type from the input type.
Source§

impl From<Failure> for Variant

Source§

fn from(value: Failure) -> Self

Converts to this type from the input type.
Source§

impl From<String> for Failure

Source§

fn from(v: String) -> Self

Converts to this type from the input type.
Source§

impl Message for Failure

Source§

fn encoded_len(&self) -> usize

Returns the encoded length of the message without a length delimiter.
Source§

fn clear(&mut self)

Clears the message, resetting all fields to their default.
Source§

fn encode(&self, buf: &mut impl BufMut) -> Result<(), EncodeError>
where Self: Sized,

Encodes the message to a buffer. Read more
Source§

fn encode_to_vec(&self) -> Vec<u8>
where Self: Sized,

Encodes the message to a newly allocated buffer.
Source§

fn encode_length_delimited( &self, buf: &mut impl BufMut, ) -> Result<(), EncodeError>
where Self: Sized,

Encodes the message with a length-delimiter to a buffer. Read more
Source§

fn encode_length_delimited_to_vec(&self) -> Vec<u8>
where Self: Sized,

Encodes the message with a length-delimiter to a newly allocated buffer.
Source§

fn decode(buf: impl Buf) -> Result<Self, DecodeError>
where Self: Default,

Decodes an instance of the message from a buffer. Read more
Source§

fn decode_length_delimited(buf: impl Buf) -> Result<Self, DecodeError>
where Self: Default,

Decodes a length-delimited instance of the message from the buffer.
Source§

fn merge(&mut self, buf: impl Buf) -> Result<(), DecodeError>
where Self: Sized,

Decodes an instance of the message from a buffer, and merges it into self. Read more
Source§

fn merge_length_delimited(&mut self, buf: impl Buf) -> Result<(), DecodeError>
where Self: Sized,

Decodes a length-delimited instance of the message from buffer, and merges it into self.
Source§

impl Name for Failure

Source§

const NAME: &'static str = "Failure"

Simple name for this Message. This name is the same as it appears in the source .proto file, e.g. FooBar.
Source§

const PACKAGE: &'static str = "temporal.api.failure.v1"

Package name this message type is contained in. They are domain-like and delimited by ., e.g. google.protobuf.
Source§

fn full_name() -> String

Fully-qualified unique name for this Message. It’s prefixed with the package name and names of any parent messages, e.g. google.rpc.BadRequest.FieldViolation. By default, this is the package name followed by the message name. Fully-qualified names must be unique within a domain of Type URLs.
Source§

fn type_url() -> String

Type URL for this Message, which by default is the full name with a leading slash, but may also include a leading domain name, e.g. type.googleapis.com/google.profile.Person. This can be used when serializing into the google.protobuf.Any type.
Source§

impl PartialEq for Failure

Source§

fn eq(&self, other: &Failure) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
§

impl PayloadVisitable for Failure

§

fn visit_payloads_mut<'a>( &'a mut self, visitor: &'a mut (dyn AsyncPayloadVisitor + Send), ) -> BoxFuture<'a, ()>

Visit all payload fields in this message. The visitor is called once per field, receiving the field’s payload(s).
§

impl Serialize for Failure

§

fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl TryFrom<Failure> for Failure

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

fn try_from(f: Failure) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl StructuralPartialEq for Failure

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> AsJsonPayloadExt for T
where T: Serialize,

Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> FromJsonPayloadExt for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> FromRef<T> for T
where T: Clone,

Source§

fn from_ref(input: &T) -> T

Converts to this type from a reference to the input type.
Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoRequest<T> for T

Source§

fn into_request(self) -> Request<T>

Wrap the input message T in a tonic::Request
Source§

impl<L> LayerExt<L> for L

Source§

fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>
where L: Layer<S>,

Applies the layer to a service and wraps it in Layered.
Source§

impl<T> Serialize for T
where T: Serialize + ?Sized,

Source§

fn erased_serialize(&self, serializer: &mut dyn Serializer) -> Result<(), Error>

Source§

fn do_erased_serialize( &self, serializer: &mut dyn Serializer, ) -> Result<(), ErrorImpl>

Source§

impl<T> TemporalDeserializable for T

Source§

fn from_serde( pc: &dyn ErasedSerdePayloadConverter, context: &SerializationContext<'_>, payload: Payload, ) -> Result<T, PayloadConversionError>

Deserialize from a serde-based payload converter.
Source§

fn from_payload( ctx: &SerializationContext<'_>, payload: Payload, ) -> Result<Self, PayloadConversionError>

Deserialize from a single Payload.
Source§

fn from_payloads( ctx: &SerializationContext<'_>, payloads: Vec<Payload>, ) -> Result<Self, PayloadConversionError>

Convert from multiple payloads. Override this for types representing multiple arguments.
Source§

impl<T> TemporalSerializable for T
where T: Serialize,

Source§

fn as_serde(&self) -> Result<&dyn Serialize, PayloadConversionError>

Return a reference to this value as a serde-serializable trait object.
Source§

fn to_payload( &self, _: &SerializationContext<'_>, ) -> Result<Payload, PayloadConversionError>

Convert this value into a single Payload.
Source§

fn to_payloads( &self, ctx: &SerializationContext<'_>, ) -> Result<Vec<Payload>, PayloadConversionError>

Convert to multiple payloads. Override this for types representing multiple arguments.
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> ErasedDestructor for T
where T: 'static,