pub struct ErrorModuleConfig {
pub code_field: String,
pub message_field: String,
pub details_field: Option<String>,
pub code_enum: Option<String>,
pub more_code_fields: Vec<String>,
pub more_message_fields: Vec<String>,
pub envelope_fields: Vec<String>,
}Expand description
Shape of the JSON error body that the generated error module reads, such as
{"error_code": "NOT_FOUND", "message": "…", "details": […]}. A body that is not such an
object becomes the message.
Fields§
§code_field: StringKey of the error code; its lowerCamelCase form is also read. Default error_code.
message_field: StringKey of the message. Default message.
details_field: Option<String>Key of the details array. Default details.
code_enum: Option<String>Fully-qualified proto enum (e.g. .my.errors.v1.ErrorCode) of the error codes. The
error exposes the code as that enum; an unknown code stays a string.
more_code_fields: Vec<String>More keys of the code, tried in order (e.g. OAuth’s error).
more_message_fields: Vec<String>More keys of the message, tried in order (e.g. OAuth’s error_description).
envelope_fields: Vec<String>Keys under which some answers nest the error object ({"error": {"message": …}}).
Trait Implementations§
Source§impl Clone for ErrorModuleConfig
impl Clone for ErrorModuleConfig
Source§impl Debug for ErrorModuleConfig
impl Debug for ErrorModuleConfig
Auto Trait Implementations§
impl Forget for ErrorModuleConfig
impl Freeze for ErrorModuleConfig
impl RefUnwindSafe for ErrorModuleConfig
impl Send for ErrorModuleConfig
impl Sync for ErrorModuleConfig
impl Unpin for ErrorModuleConfig
impl UnsafeUnpin for ErrorModuleConfig
impl UnwindSafe for ErrorModuleConfig
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