Pocket / extension-save-to-pocket

Save to Pocket is a browser extension that is used to save pages to a connected Pocket account
https://getpocket.com
MIT License
273 stars 48 forks source link

fix(storage): add error handling to setting or getting storage #278

Closed anthony-liddle closed 1 year ago

anthony-liddle commented 2 years ago

Goal

Addressing errors captured by Sentry.

The storage errors seem to be the biggest culprit with the authentication issues experienced by some users. If Chrome can't get or set items to the local storage, there is no way to save a user's auth status.

to be merged into https://github.com/Pocket/extension-save-to-pocket/pull/276

image

Todos:

Implementation Decisions

IO error: ... FILE_ERROR_NO_SPACE (ChromeMethodBFE: 3::WritableFileAppend::8)

This is a Chrome level error and is related to a user's available disc space when trying to write to chrome.storage. There isn't any real documentation on this error provided by Google. In my research I came across another open-source extension where users experienced this issue and it was solved by clearing hard-drive space and rebooting the browser. Not ideal. I've added error handling to our helper function that sets the storage, as well as error logging into Sentry


IO error: .../LOCK: File currently in use. (ChromeMethodBFE: 15::LockFile::2)

This another Chrome level error is caused by Chrome leaving old or "zombie" processes running. Here's a thread that discusses these processes in regards to a similar (but seemingly related) issue: https://bugs.chromium.org/p/chromium/issues/detail?id=490915

Similar to the no space error, there is no documentation provided by Google for this issue. However research surfaced two other extensions with this issue that were fixed by restarting the browser, or restarting the computer. I've added error logging into Sentry when this action fails.


The message port closed before a response was received.

When you add a listener on browser message events you always need to return a promise. Documentation: