pub trait ErrorType {
    // Required methods
    fn code(&self) -> ErrorCode;
    fn name(&self) -> &str;
    fn instance_id(&self) -> Option<Uuid>;
    fn safe_args(&self) -> &'static [&'static str];

    // Provided method
    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(&self) -> ErrorCode

Returns the error’s code.

source

fn name(&self) -> &str

Returns the error’s name.

The name must be formatted like NamespaceName:ErrorName.

source

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

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

Conjure-generated error types return None, but other implementations like those for SerializableError and WithInstanceId return a value.

source

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

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

Provided Methods§

source

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

Wraps the error in another that overrides its instance ID.

Implementations on Foreign Types§

source§

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

source§

fn code(&self) -> ErrorCode

source§

fn name(&self) -> &str

source§

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

source§

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

Implementors§