aecreations / sync-clippings

Sync Clippings Helper
Mozilla Public License 2.0
1 stars 1 forks source link

Pass along errors when reading the sync file to the extension #20

Open aecreations opened 6 months ago

aecreations commented 6 months ago

Currently, Sync Clippings Helper swallows any errors that may occur when reading the sync file. One example is on macOS, where an error would occur if Sync Clippings Helper doesn't have full disk access (Python error: [Errno 1] Operation not permitted: <full path to file>) - there doesn't seem to be a way to resolve this (giving Sync Clippings Helper full disk access from System Settings -> Security & Privacy doesn't work).

If such an error occurs, Sync Clippings should send a response back to Clippings containing error information, so that the extension can show an appropriate error message to the user, possibly via a notification.

aecreations commented 6 months ago

Since older versions of Clippings won't be able to handle error responses from Sync Clippings Helper 2.0 when getting the sync data, the error response should be sent when handling the new native message "get-compressed-synced-clippings".

The structure of the error response should be as follows:

{
  "status": "failure"
  "details": <The exception details from Python>
}

Clippings should check for the value of the details property to determine the appropriate user-facing error message to display.