Moved database error to only show local error message
This commit is contained in:
parent
24870666fb
commit
d8f3ae43f5
@ -15,7 +15,6 @@ export function DatabaseProvider({ children }) {
|
||||
const [database, setDatabase] = useState();
|
||||
const [databaseStatus, setDatabaseStatus] = useState("loading");
|
||||
const [databaseError, setDatabaseError] = useState();
|
||||
// const [worker] = useState(Comlink.wrap(new DatabaseWorker()))
|
||||
|
||||
useEffect(() => {
|
||||
// Create a test database and open it to see if indexedDB is enabled
|
||||
@ -45,13 +44,19 @@ export function DatabaseProvider({ children }) {
|
||||
};
|
||||
|
||||
function handleDatabaseError(event) {
|
||||
if (event.reason?.name === "QuotaExceededError") {
|
||||
event.preventDefault();
|
||||
if (event.reason?.name === "QuotaExceededError") {
|
||||
setDatabaseError({
|
||||
name: event.reason.name,
|
||||
message: "Storage Quota Exceeded Please Clear Space and Try Again.",
|
||||
});
|
||||
} else {
|
||||
setDatabaseError({
|
||||
name: event.reason.name,
|
||||
message: "Something went wrong, please refresh your browser.",
|
||||
});
|
||||
}
|
||||
console.error(event.reason);
|
||||
}
|
||||
window.addEventListener("unhandledrejection", handleDatabaseError);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user