MCPcopy Create free account
hub / github.com/compozy/agh / ShouldRecoverSQLite

Function ShouldRecoverSQLite

internal/store/sqlite.go:222–237  ·  view source on GitHub ↗

ShouldRecoverSQLite reports whether the open error indicates recoverable corruption.

(err error)

Source from the content-addressed store, hash-verified

220
221// ShouldRecoverSQLite reports whether the open error indicates recoverable corruption.
222func ShouldRecoverSQLite(err error) bool {
223 if err == nil {
224 return false
225 }
226
227 var sqliteErr *sqlite.Error
228 if !errors.As(err, &sqliteErr) {
229 return false
230 }
231 switch sqliteErr.Code() & sqlitePrimaryResultCodeMask {
232 case sqlite3.SQLITE_CORRUPT, sqlite3.SQLITE_NOTADB:
233 return true
234 default:
235 return false
236 }
237}
238
239func closeQuietly(db *sql.DB) {
240 if db != nil {

Callers 2

shouldRecoverSQLiteFunction · 0.85

Calls 1

CodeMethod · 0.65

Tested by

no test coverage detected