Plugin to Catch all QuotaExceedErrors

19 views
Skip to first unread message

mikeymckay

unread,
Dec 17, 2018, 7:07:43 AM12/17/18
to PouchDB
Pouchers!

I have an app that does a lot of replications with a lot of databases on tablets. I have a problem with QuotaExceededErrors, and they are tricky to catch. I would like to write a plugin, or any other hack, that would automatically listen for error events on any pouchdb replication and pop up an ugly alert message if it is the QuotaExceededError. Other than making sure every that every replication call has the following added:

              .on "error", (error) =>
                if error.reason is "QuotaExceededError"
                  alert "You are out of disk space. Please free up disk space and try again. You may need to restart the device if the error persists after freeing up disk space"

Is there a way to hook this event and apply it globally?

Mike
Reply all
Reply to author
Forward
0 new messages