Synthoid / ExportSheetData

Add-on for Google Sheets that allows sheets to be exported as JSON or XML.
MIT License
234 stars 46 forks source link

(Bug) Error catchers cannot handle google service errors #135

Open Synthoid opened 3 years ago

Synthoid commented 3 years ago

Describe the bug The current error handlers implemented to catch errors thrown by ESD and fail gracefully can only catch errors thrown by ESD, not Google services (ie accessing spreadsheets, Drive, etc). This means that bugs such as the multiple account issue will fail with no obvious guidance on what to do. I think this is the cause of the recent influx of "doesn't work" posts on ESD's listing page.

To Reproduce Due to the nature of the multi-account bug, it is not easy to replicate. This is likely occurring whenever ESD attempts to access or write data, as shown in Google Cloud error logs.

Expected behavior Google service errors are caught and display a popup. I believe that the service error is being detected and caught by ESD, but the current method of displaying errors actually uses SpreadsheeetApp.getUi() which is throwing another google service error. I may be able to get around this by wrapping the sidebar's attempt to launch the export process with a try-catch that shows a JavaScript alert (it seems like the only way the ESD backend can show popups is through the UI class, which is part of the issue).