Fix database error not showing the right message
This commit is contained in:
parent
cd826595cd
commit
b7793626cf
@ -72,12 +72,14 @@ export function DatabaseProvider({ children }) {
|
||||
function handleDatabaseError(event) {
|
||||
if (event) {
|
||||
event.preventDefault();
|
||||
if (event.reason instanceof Dexie.QuotaExceededError) {
|
||||
if (event.reason instanceof Dexie.DexieError) {
|
||||
if (event.reason?.inner?.name === "QuotaExceededError") {
|
||||
setDatabaseError({
|
||||
name: event.reason?.name,
|
||||
message: "Storage Quota Exceeded Please Clear Space and Try Again.",
|
||||
message:
|
||||
"Storage Quota Exceeded Please Clear Space and Try Again.",
|
||||
});
|
||||
} else if (event.reason instanceof Dexie.DatabaseClosedError) {
|
||||
} else if (event.reason?.inner?.name === "DatabaseClosedError") {
|
||||
setDatabaseError({
|
||||
name: event.reason?.name,
|
||||
message: "Database closed, please refresh your browser.",
|
||||
@ -88,6 +90,12 @@ export function DatabaseProvider({ children }) {
|
||||
message: "Something went wrong, please refresh your browser.",
|
||||
});
|
||||
}
|
||||
} else {
|
||||
setDatabaseError({
|
||||
name: event.reason?.name,
|
||||
message: "Something went wrong, please refresh your browser.",
|
||||
});
|
||||
}
|
||||
console.error(event.reason);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user