pub struct ApiError {
pub code: ErrorCode,
pub message: String,
pub details: Option<String>,
pub error_key: Option<String>,
pub path: Option<String>,
pub validation_errors: Vec<ValidationError>,
pub timestamp: DateTime<Utc>,
pub trace_id: Option<String>,
}Fields§
§code: ErrorCode§message: String§details: Option<String>§error_key: Option<String>§path: Option<String>§validation_errors: Vec<ValidationError>§timestamp: DateTime<Utc>§trace_id: Option<String>Implementations§
Source§impl ApiError
impl ApiError
pub fn new(code: ErrorCode, message: impl Into<String>) -> Self
pub fn with_details(self, details: impl Into<String>) -> Self
pub fn with_error_key(self, key: impl Into<String>) -> Self
pub fn with_path(self, path: impl Into<String>) -> Self
pub fn with_validation_errors(self, errors: Vec<ValidationError>) -> Self
pub fn with_trace_id(self, id: impl Into<String>) -> Self
pub fn not_found(message: impl Into<String>) -> Self
pub fn bad_request(message: impl Into<String>) -> Self
pub fn forbidden(message: impl Into<String>) -> Self
pub fn internal_error(message: impl Into<String>) -> Self
pub fn validation_error( message: impl Into<String>, errors: Vec<ValidationError>, ) -> Self
pub fn conflict(message: impl Into<String>) -> Self
Trait Implementations§
Source§impl ApiErrorExt for ApiError
impl ApiErrorExt for ApiError
fn with_request_context(self, ctx: &RequestContext) -> Self
Source§impl<'de> Deserialize<'de> for ApiError
impl<'de> Deserialize<'de> for ApiError
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
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 From<InternalApiError> for ApiError
impl From<InternalApiError> for ApiError
Source§fn from(error: InternalApiError) -> Self
fn from(error: InternalApiError) -> Self
Converts to this type from the input type.
Source§impl From<RepositoryError> for ApiError
impl From<RepositoryError> for ApiError
Source§fn from(err: RepositoryError) -> Self
fn from(err: RepositoryError) -> Self
Converts to this type from the input type.
Source§impl From<ServiceError> for ApiError
impl From<ServiceError> for ApiError
Source§fn from(err: ServiceError) -> Self
fn from(err: ServiceError) -> Self
Converts to this type from the input type.
Auto Trait Implementations§
impl Freeze for ApiError
impl RefUnwindSafe for ApiError
impl Send for ApiError
impl Sync for ApiError
impl Unpin for ApiError
impl UnwindSafe for ApiError
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