pub enum Error {
Validation(Vec<FieldError>),
ProjectNotFound(String),
NamedNotFound(String),
NotFound,
WriterGone,
SchemaUnknown {
found: Vec<i64>,
expected: i64,
},
Sqlite(Error),
Json(Error),
}Variants§
Validation(Vec<FieldError>)
One or more changeset-style validation failures. The Elixir side
returns {:error, %Ecto.Changeset{errors: [...]}}; we carry the
equivalent (field, message) pairs so callers (and tests) can assert
on the same field/message contract.
ProjectNotFound(String)
{:error, :project_not_found} / Repo.rollback(:project_not_found).
NamedNotFound(String)
A lookup that can name the missing identity.
NotFound
{:error, :not_found}.
WriterGone
The writer task is gone (channel closed). Should not happen in normal operation; surfaced so callers can fail loudly rather than hang.
SchemaUnknown
The schema_migrations ledger holds a version this build has never
heard of and that is older than its own — the database was not
written by any cliban we recognize. (A newer version is fine; see
crate::migrations::run.)
Sqlite(Error)
Json(Error)
Implementations§
Source§impl Error
impl Error
Sourcepub fn validation(field: &str, message: &str) -> Self
pub fn validation(field: &str, message: &str) -> Self
Construct a single-field validation error, mirroring
Ecto.Changeset.add_error(cs, field, msg).
Sourcepub fn has_validation(&self, field: &str, needle: &str) -> bool
pub fn has_validation(&self, field: &str, needle: &str) -> bool
True if this is a validation error mentioning field with a message
that contains needle. Test convenience that mirrors the Elixir tests’
cs.errors[:field] =~ needle assertions.
Trait Implementations§
Source§impl Error for Error
impl Error for Error
Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()