gloo/error
All errors returned by gloom repo functions are wrapped in GlooError.
Use map_constraint or map_constraints to convert ConstraintError
into application-specific error types without losing the constraint name.
Types
Values
pub fn from_pog(e: pog.QueryError) -> GlooError
pub fn from_sqlight(e: sqlight.Error) -> GlooError
pub fn map_constraint(
result: Result(t, GlooError),
constraint_name: String,
on_match: mapped_error,
fallback: fn(GlooError) -> mapped_error,
) -> Result(t, mapped_error)
Map a specific constraint violation to a typed error.
All other errors are re-wrapped via fallback.
Example: repo.query_one(repo, q) |> error.map_constraint(“users_email_idx”, EmailAlreadyTaken, DbFailed)