Copied across from https://community.apollographql.com/t/ioss-sqliteerror-doesnt-expose-underlying-sqlite-error-code/9440.
In Pre 1.0 Apollo the calls like:
do {
return try SQLiteNormalizedCache(fileURL: fileURL)
} catch let sqlError as SQLite.Result {
... error handling
}
would throw the SQLite native SQLite.Result error. This allowed client code to precisely catch errors like SQLITE_CORRUPT, SQLITE_NOTADB, SQLITE_BUSY, etc.
In 1.0+ of the Apollo library the underlying SQLite error codes are no longer available. Instead there’s a less expressive enum based Error:
public enum SQLiteError: Error, CustomStringConvertible {
case execution(message: String)
case open(path: String)
case prepare(message: String)
case step(message: String)
}
Am I missing something? Could the error code be added as another associated value?
Copied across from https://community.apollographql.com/t/ioss-sqliteerror-doesnt-expose-underlying-sqlite-error-code/9440.