#[non_exhaustive]pub enum RepositoryError {
Show 13 variants
NotFound {
entity: &'static str,
key: Option<String>,
},
Conflict {
entity: &'static str,
key: String,
reason: String,
},
Constraint {
kind: ConstraintKind,
constraint: String,
source: Box<dyn Error + Sync + Send>,
},
InvalidArgument {
field: &'static str,
reason: String,
},
InvalidData {
field: &'static str,
reason: String,
},
Decode {
context: String,
source: Box<dyn Error + Sync + Send>,
},
Database {
sqlstate: Option<String>,
source: Box<dyn Error + Sync + Send>,
},
Serialization(Error),
SqlParse(Box<dyn Error + Sync + Send>),
Connection(Box<RepositoryError>),
Statement {
statement: String,
source: Box<RepositoryError>,
},
SqlFile {
path: String,
source: Error,
},
TransactionConsumed,
}Expand description
The single repository error type of the workspace.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
NotFound
Conflict
Constraint
InvalidArgument
InvalidData
Decode
Database
Serialization(Error)
SqlParse(Box<dyn Error + Sync + Send>)
Connection(Box<RepositoryError>)
Statement
SqlFile
TransactionConsumed
Implementations§
Source§impl RepositoryError
impl RepositoryError
pub fn not_found(entity: &'static str, key: impl Display) -> RepositoryError
pub fn conflict( entity: &'static str, key: impl Display, reason: impl Into<String>, ) -> RepositoryError
pub fn invalid_argument( field: &'static str, reason: impl Into<String>, ) -> RepositoryError
pub fn invalid_data( field: &'static str, reason: impl Into<String>, ) -> RepositoryError
pub fn decode( context: impl Into<String>, source: impl Into<Box<dyn Error + Sync + Send>>, ) -> RepositoryError
pub fn database( source: impl Into<Box<dyn Error + Sync + Send>>, ) -> RepositoryError
pub fn sqlstate(&self) -> Option<&str>
pub const fn is_not_found(&self) -> bool
pub const fn is_constraint(&self) -> bool
pub const fn is_conflict(&self) -> bool
pub fn is_serialization_failure(&self) -> bool
pub fn is_invalid_function_definition(&self) -> bool
Trait Implementations§
Source§impl Debug for RepositoryError
impl Debug for RepositoryError
Source§impl Display for RepositoryError
impl Display for RepositoryError
Source§impl Error for RepositoryError
impl Error for RepositoryError
Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
👎Deprecated since 1.42.0:
use the Display impl or to_string()
Source§impl From<Error> for RepositoryError
impl From<Error> for RepositoryError
Source§fn from(source: Error) -> RepositoryError
fn from(source: Error) -> RepositoryError
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.
Auto Trait Implementations§
impl !RefUnwindSafe for RepositoryError
impl !UnwindSafe for RepositoryError
impl Freeze for RepositoryError
impl Send for RepositoryError
impl Sync for RepositoryError
impl Unpin for RepositoryError
impl UnsafeUnpin for RepositoryError
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
impl<A, B, T> HttpServerConnExec<A, B> for Twhere
B: Body,
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