diff --git a/rusqlite_migration/src/errors.rs b/rusqlite_migration/src/errors.rs index 7dcfc3b..345e981 100644 --- a/rusqlite_migration/src/errors.rs +++ b/rusqlite_migration/src/errors.rs @@ -86,9 +86,19 @@ impl Error { impl fmt::Display for Error { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { match self { - Error::SpecifiedSchemaVersion(e) => write!(f, "rusqlite_migrate error: {e}"), - // TODO Format the error with fmt instead of debug - _ => write!(f, "rusqlite_migrate error: {self:?}"), + Error::RusqliteError { query, err: e } => write!( + f, + "rusqlite_migration error while executing query '{query}': {e}" + ), + Error::SpecifiedSchemaVersion(e) => { + write!(f, "error with the specified schema version: {e}") + } + Error::MigrationDefinition(e) => { + todo!() + } + Error::ForeignKeyCheck(vec) => todo!(), + Error::Unrecognized(ref e) => todo!(), + Error::Hook(_) | Error::FileLoad(_) | Error::InvalidUserVersion => todo!(), } } } diff --git a/rusqlite_migration/src/errors/snapshots/rusqlite_migration__errors__tests__error_display__rusqlite_error.snap b/rusqlite_migration/src/errors/snapshots/rusqlite_migration__errors__tests__error_display__rusqlite_error.snap index 6470987..af51d67 100644 --- a/rusqlite_migration/src/errors/snapshots/rusqlite_migration__errors__tests__error_display__rusqlite_error.snap +++ b/rusqlite_migration/src/errors/snapshots/rusqlite_migration__errors__tests__error_display__rusqlite_error.snap @@ -3,4 +3,4 @@ source: rusqlite_migration/src/errors/tests.rs expression: e snapshot_kind: text --- -rusqlite_migrate error: RusqliteError { query: "SELECT * FROM table42;", err: InvalidQuery } +rusqlite_migrate error while executing query 'SELECT * FROM table42;': Query is not read-only diff --git a/rusqlite_migration/src/errors/snapshots/rusqlite_migration__errors__tests__error_display__specified_schema_version.snap b/rusqlite_migration/src/errors/snapshots/rusqlite_migration__errors__tests__error_display__specified_schema_version.snap index d1a7f1f..9870b57 100644 --- a/rusqlite_migration/src/errors/snapshots/rusqlite_migration__errors__tests__error_display__specified_schema_version.snap +++ b/rusqlite_migration/src/errors/snapshots/rusqlite_migration__errors__tests__error_display__specified_schema_version.snap @@ -3,4 +3,4 @@ source: rusqlite_migration/src/errors/tests.rs expression: e snapshot_kind: text --- -rusqlite_migrate error: Attempt to migrate to version 0 (no version set), which is higher than the highest version currently supported, 0 (no version set). +error with the specified schema version: Attempt to migrate to version 0 (no version set), which is higher than the highest version currently supported, 0 (no version set). diff --git a/rusqlite_migration/src/errors/snapshots/rusqlite_migration__errors__tests__error_display__too_high_schema_version.snap b/rusqlite_migration/src/errors/snapshots/rusqlite_migration__errors__tests__error_display__too_high_schema_version.snap index 41e5ec1..cd78560 100644 --- a/rusqlite_migration/src/errors/snapshots/rusqlite_migration__errors__tests__error_display__too_high_schema_version.snap +++ b/rusqlite_migration/src/errors/snapshots/rusqlite_migration__errors__tests__error_display__too_high_schema_version.snap @@ -3,4 +3,4 @@ source: rusqlite_migration/src/errors/tests.rs expression: e snapshot_kind: text --- -rusqlite_migrate error: Attempt to use a schema version higher than supported. +error with the specified schema version: Attempt to use a schema version higher than supported.