pub struct Refusal {
pub code: KernelErrorCode,
pub message: String,
pub detail: Option<Value>,
}Expand description
A refusal, already shaped as the answer the wire will send.
The contract makes a refusal a VALUE (KernelResult::Error), so this
carries the wire code from the start instead of being translated at the
boundary and losing the reason on the way.
Fields§
§code: KernelErrorCode§message: String§detail: Option<Value>Implementations§
Source§impl Refusal
impl Refusal
pub fn new(code: KernelErrorCode, message: impl Into<String>) -> Self
pub fn with_detail(self, detail: Value) -> Self
pub fn validation(message: impl Into<String>) -> Self
pub fn not_found(message: impl Into<String>) -> Self
pub fn storage(message: impl Into<String>) -> Self
pub fn into_result(self) -> KernelResult
Trait Implementations§
Source§impl From<AppendError> for Refusal
impl From<AppendError> for Refusal
Source§fn from(error: AppendError) -> Self
fn from(error: AppendError) -> Self
The store’s refusals, given their wire codes. VersionConflict and
Fenced carry their numbers into detail because a caller that means
to retry needs the actual value, not just the name of the failure.
Source§impl From<StorageError> for Refusal
impl From<StorageError> for Refusal
Source§fn from(error: StorageError) -> Self
fn from(error: StorageError) -> Self
Converts to this type from the input type.
impl StructuralPartialEq for Refusal
Auto Trait Implementations§
impl Freeze for Refusal
impl RefUnwindSafe for Refusal
impl Send for Refusal
impl Sync for Refusal
impl Unpin for Refusal
impl UnsafeUnpin for Refusal
impl UnwindSafe for Refusal
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 more