web: better handling of database disk image is malformed error

This commit is contained in:
Abdullah Atta
2024-05-13 09:55:06 +05:00
parent 58845e5508
commit e722866d62

View File

@@ -162,9 +162,9 @@ function getErrorHelp(props: FallbackProps) {
if (
errorText.includes("file is not a database") ||
errorText.includes("unsupported file format") ||
errorText.includes("database disk image is malformed") ||
errorText.includes("null function or function signature mismatch") ||
errorText.includes("malformed database schema")
errorText.includes("malformed database schema") ||
/table ".+?" already exists/.test(errorText)
) {
return {
explanation: `This error usually means the database file is either corrupt or it could not be decrypted.`,
@@ -195,6 +195,17 @@ function getErrorHelp(props: FallbackProps) {
resetErrorBoundary();
}
};
} else if (errorText.includes("database disk image is malformed")) {
return {
explanation: `This error usually means the search index is corrupted.`,
action:
"This error can be fixed by rebuilding the search index. This action won't result in any kind of data loss.",
fix: async () => {
const { db } = await import("../../common/db");
await db.lookup.rebuild();
resetErrorBoundary();
}
};
}
}