Skip to main content

FrankenError

Enum FrankenError 

Source
pub enum FrankenError {
Show 60 variants DatabaseNotFound { path: PathBuf, }, DatabaseLocked { path: PathBuf, }, DatabaseCorrupt { detail: String, }, NotADatabase { path: PathBuf, }, DatabaseFull, SchemaChanged, Io(Error), IoRead { page: u32, }, IoWrite { page: u32, }, ShortRead { expected: usize, actual: usize, }, SyntaxError { token: String, }, ParseError { offset: usize, detail: String, }, QueryReturnedNoRows, QueryReturnedMultipleRows, NoSuchTable { name: String, }, NoSuchColumn { name: String, }, NoSuchIndex { name: String, }, TableExists { name: String, }, IndexExists { name: String, }, AmbiguousColumn { name: String, }, UniqueViolation { columns: String, }, NotNullViolation { column: String, }, CheckViolation { name: String, }, ForeignKeyViolation, PrimaryKeyViolation, DatatypeViolation { column: String, column_type: String, actual: String, }, NestedTransaction, NoActiveTransaction, TransactionRolledBack { reason: String, }, WriteConflict { page: u32, holder: u64, }, SerializationFailure { page: u32, }, SnapshotTooOld { txn_id: u64, }, Busy, BusyRecovery, BusySnapshot { conflicting_pages: String, }, ConcurrentUnavailable, TypeMismatch { expected: String, actual: String, }, IntegerOverflow, OutOfRange { what: String, value: String, }, TooBig, TooManyColumns { count: usize, max: usize, }, SqlTooLong { length: usize, max: usize, }, ExpressionTooDeep { max: usize, }, TooManyAttached { max: usize, }, TooManyArguments { name: String, }, WalCorrupt { detail: String, }, CheckpointFailed { detail: String, }, LockFailed { detail: String, }, CannotOpen { path: PathBuf, }, Internal(String), Unsupported, NotImplemented(String), Abort, AuthDenied, OutOfMemory, FunctionError(String), BackgroundWorkerFailed(String), ReadOnly, Interrupt, VdbeExecutionError { detail: String, },
}
Expand description

Primary error type for FrankenSQLite operations.

Modeled after SQLite’s error codes with Rust-idiomatic structure. Follows the pattern from beads_rust: structured variants for common cases, recovery hints for user-facing errors.

Variants§

§

DatabaseNotFound

Database file not found.

Fields

§path: PathBuf
§

DatabaseLocked

Database file is locked by another process.

Fields

§path: PathBuf
§

DatabaseCorrupt

Database file is corrupt.

Fields

§detail: String
§

NotADatabase

Database file is not a valid SQLite database.

Fields

§path: PathBuf
§

DatabaseFull

Database is full (max page count reached).

§

SchemaChanged

Database schema has changed since the statement was prepared.

§

Io(Error)

File I/O error.

§

IoRead

Disk I/O error during database read.

Fields

§page: u32
§

IoWrite

Disk I/O error during database write.

Fields

§page: u32
§

ShortRead

Short read (fewer bytes than expected).

Fields

§expected: usize
§actual: usize
§

SyntaxError

SQL syntax error.

Fields

§token: String
§

ParseError

SQL parsing error at a specific position.

Fields

§offset: usize
§detail: String
§

QueryReturnedNoRows

Query executed successfully but produced no rows.

§

QueryReturnedMultipleRows

Query executed successfully but produced more than one row.

§

NoSuchTable

No such table.

Fields

§name: String
§

NoSuchColumn

No such column.

Fields

§name: String
§

NoSuchIndex

No such index.

Fields

§name: String
§

TableExists

Table already exists.

Fields

§name: String
§

IndexExists

Index already exists.

Fields

§name: String
§

AmbiguousColumn

Ambiguous column reference.

Fields

§name: String
§

UniqueViolation

UNIQUE constraint violation.

Fields

§columns: String
§

NotNullViolation

NOT NULL constraint violation.

Fields

§column: String
§

CheckViolation

CHECK constraint violation.

Fields

§name: String
§

ForeignKeyViolation

FOREIGN KEY constraint violation.

§

PrimaryKeyViolation

PRIMARY KEY constraint violation.

§

DatatypeViolation

STRICT table datatype constraint violation (SQLITE_CONSTRAINT_DATATYPE).

Fields

§column: String
§column_type: String
§actual: String
§

NestedTransaction

Cannot start a transaction within a transaction.

§

NoActiveTransaction

No transaction is active.

§

TransactionRolledBack

Transaction was rolled back due to constraint violation.

Fields

§reason: String
§

WriteConflict

Page-level write conflict (another transaction modified the same page).

Fields

§page: u32
§holder: u64
§

SerializationFailure

Serialization failure (first-committer-wins violation).

Fields

§page: u32
§

SnapshotTooOld

Snapshot is too old (required versions have been garbage collected).

Fields

§txn_id: u64
§

Busy

Database is busy (the SQLite classic).

§

BusyRecovery

Database is busy due to recovery.

§

BusySnapshot

Concurrent transaction commit failed due to page conflict (SQLITE_BUSY_SNAPSHOT). Another transaction committed changes to pages in the write set since the snapshot was established.

Fields

§conflicting_pages: String
§

ConcurrentUnavailable

BEGIN CONCURRENT is not available without fsqlite-shm (§5.6.6.2).

§

TypeMismatch

Type mismatch in column access.

Fields

§expected: String
§actual: String
§

IntegerOverflow

Integer overflow during computation.

§

OutOfRange

Value out of range.

Fields

§what: String
§value: String
§

TooBig

String or BLOB exceeds the size limit.

§

TooManyColumns

Too many columns.

Fields

§count: usize
§max: usize
§

SqlTooLong

SQL statement too long.

Fields

§length: usize
§max: usize
§

ExpressionTooDeep

Expression tree too deep.

Fields

§max: usize
§

TooManyAttached

Too many attached databases.

Fields

§max: usize
§

TooManyArguments

Too many function arguments.

Fields

§name: String
§

WalCorrupt

WAL file is corrupt.

Fields

§detail: String
§

CheckpointFailed

WAL checkpoint failed.

Fields

§detail: String
§

LockFailed

File locking failed.

Fields

§detail: String
§

CannotOpen

Cannot open file.

Fields

§path: PathBuf
§

Internal(String)

Internal logic error (should never happen).

§

Unsupported

Operation is not supported by the current backend or configuration.

§

NotImplemented(String)

Feature not yet implemented.

§

Abort

Abort due to callback.

§

AuthDenied

Authorization denied.

§

OutOfMemory

Out of memory.

§

FunctionError(String)

SQL function domain/runtime error (analogous to sqlite3_result_error).

§

BackgroundWorkerFailed(String)

A background runtime worker failed and poisoned the shared database state.

§

ReadOnly

Attempt to write a read-only database or virtual table.

§

Interrupt

Interrupted by a cancellation-aware execution context.

§

VdbeExecutionError

Execution error within the VDBE bytecode engine.

Fields

§detail: String

Implementations§

Source§

impl FrankenError

Source

pub const fn error_code(&self) -> ErrorCode

Map this error to a SQLite error code for compatibility.

Source

pub const fn is_user_recoverable(&self) -> bool

Whether the user can likely fix this without code changes.

Source

pub const fn suggestion(&self) -> Option<&'static str>

Human-friendly suggestion for fixing this error.

Source

pub const fn is_transient(&self) -> bool

Whether this is a transient error that may succeed on retry.

Source

pub const fn exit_code(&self) -> i32

Get the process exit code for this error (for CLI use).

Source

pub const fn extended_error_code(&self) -> i32

Get the extended SQLite error code.

SQLite extended error codes encode additional information in the upper bits: extended_code = (ext_num << 8) | base_code

For most errors, this returns the base error code. For BUSY variants:

  • Busy → 5 (SQLITE_BUSY)
  • BusyRecovery → 261 (SQLITE_BUSY_RECOVERY = 5 | (1 << 8))
  • BusySnapshot → 517 (SQLITE_BUSY_SNAPSHOT = 5 | (2 << 8))
Source

pub fn syntax(token: impl Into<String>) -> Self

Create a syntax error.

Source

pub fn parse(offset: usize, detail: impl Into<String>) -> Self

Create a parse error.

Source

pub fn internal(msg: impl Into<String>) -> Self

Create an internal error.

Source

pub fn not_implemented(feature: impl Into<String>) -> Self

Create a not-implemented error.

Source

pub fn function_error(msg: impl Into<String>) -> Self

Create a function domain error.

Trait Implementations§

Source§

impl Debug for FrankenError

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Display for FrankenError

Source§

fn fmt(&self, __formatter: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Error for FrankenError

Source§

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

👎Deprecated since 1.42.0:

use the Display impl or to_string()

1.0.0 · Source§

fn cause(&self) -> Option<&dyn Error>

👎Deprecated since 1.33.0:

replaced by Error::source, which can support downcasting

Source§

fn provide<'a>(&'a self, request: &mut Request<'a>)

🔬This is a nightly-only experimental API. (error_generic_member_access)
Provides type-based access to context intended for error reports. Read more
Source§

impl From<Error> for FrankenError

Source§

fn from(source: Error) -> Self

Converts to this type from the input type.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.