fix: clear recovery message on SQLITE_CORRUPT migration failure#3086
Conversation
…ilure When a migration fails with SQLITE_CORRUPT (common on Raspberry Pi due to SD card wear or power loss), the app previously crashed with a raw Node.js stack trace. Now it logs an actionable error box showing the database path and the exact commands to back up the corrupted file and start fresh. Closes #3085 https://claude.ai/code/session_01MgkrgSs7F5W22HtMT6tPhM
|
Claude finished @Yeraze's task —— View job PR Review Complete ✅I've completed a thorough review of this pull request. Here's my detailed feedback: Review Checklist:
Code Quality & Best Practices ✅The implementation demonstrates solid coding practices:
Potential Issues & Suggestions 🔍Minor Enhancement Opportunity: interface SqliteError extends Error {
code: string;
}
function isSqliteError(error: unknown): error is SqliteError {
return error instanceof Error && 'code' in error;
}However, the current implementation is perfectly functional and the type checking is adequate. Performance Considerations ✅
Security Concerns ✅
Test Coverage Assessment
|
$(cat <<'EOF'
Summary
SQLITE_CORRUPTerrors during SQLite migration runs and replaces the raw Node.js stack-trace crash with a clear, actionable error messageFixes #3085 — reported on Raspberry Pi / Raspbian baremetal where SD card corruption caused
SqliteError: database disk image is malformedduring migration 059.What changed
src/services/database.ts— in the SQLite migration loop's catch block, added a check forerror.code === 'SQLITE_CORRUPT'. When detected, logs a formatted message like:Then calls
process.exit(1)rather than rethrowing (which produced an unhelpfulUncaughtExceptioncrash).Test plan
https://claude.ai/code/session_01MgkrgSs7F5W22HtMT6tPhM
EOF
)
Generated by Claude Code