ErrorType

Trait ErrorType 

Source
pub trait ErrorType {
    // Required methods
    fn code() -> ErrorCode;
    fn name() -> &'static str;
    fn safe_args() -> &'static [&'static str];

    // Provided methods
    fn instance_id(&self) -> Option<Uuid> { ... }
    fn with_instance_id(self, instance_id: Uuid) -> WithInstanceId<Self>
       where Self: Sized { ... }
}
Expand description

A trait implemented by Conjure error types.

Required Methods§

Source

fn code() -> ErrorCode

Returns the error’s code.

Source

fn name() -> &'static str

Returns the error’s name.

The name must be formatted like NamespaceName:ErrorName.

Source

fn safe_args() -> &'static [&'static str]

Returns a sorted slice of the names of the error’s safe parameters.

Provided Methods§

Source

fn instance_id(&self) -> Option<Uuid>

Returns the error’s instance ID, if it stores one.

The default implementation returns None.

Source

fn with_instance_id(self, instance_id: Uuid) -> WithInstanceId<Self>
where Self: Sized,

Wraps the error in another that overrides its instance ID.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl<T> ErrorType for &T
where T: ?Sized + ErrorType,

Source§

fn code() -> ErrorCode

Source§

fn name() -> &'static str

Source§

fn instance_id(&self) -> Option<Uuid>

Source§

fn safe_args() -> &'static [&'static str]

Implementors§