Skip to main content

Module error

Module error 

Source
Expand description

Application error type and HTTP mapping.

Enums§

Error
Top-level error for the web service. Wraps the various library and IO errors so that handlers can use ? and the central IntoResponse impl turns them into HTTP responses.

Functions§

is_fk_violation
Returns true when the given sqlx error wraps a SQLite foreign-key constraint violation. SQLite reports these as either extended code 787 (SQLITE_CONSTRAINT_FOREIGNKEY) or, for deferred / trigger-mediated failures, 1811 (SQLITE_CONSTRAINT_TRIGGER). To be robust across both we also fall back to a substring check of the error message.
is_unique_violation
Returns true when the given sqlx error wraps a SQLite uniqueness constraint violation. SQLite reports these as extended code 2067 (SQLITE_CONSTRAINT_UNIQUE) or, for an INTEGER PRIMARY KEY clash, 1555 (SQLITE_CONSTRAINT_PRIMARYKEY). As with is_fk_violation we also fall back to a substring check of the error message.