news-catalyst / google-app-scripts

a collection of scripts for tinynews google docs add-ons
https://script.google.com/a/newscatalyst.org/d/1ILURq69o3cYUy6k1n1X6HwxdMfl9xWNhILYuZxgLfeblb3IR15WCMZSj/edit
1 stars 1 forks source link

nicer error reporting to editors #411

Open jacqui opened 2 years ago

jacqui commented 2 years ago

Instead of displaying an error like the following to someone trying to edit an article, catch it and give a nicer explanation that makes sense:

Re-Publish: An error occurred: ScriptError: Exception: API call to docs.documents.get failed with error: Empty response

Suggestions welcome, but one idea (from me) is:

Re-Publish: Sorry, Google Docs seems to be having an issue at the moment. Try again in a few minutes. If this problem persists, contact #tech-support on tinynews.slack.com.

I'm happy to make the code change - some input on how best to convey something's gone wrong (that might not be in our control) would be great though!

Also, note: if possible we should catch types of error and display a message that makes sense for each. In the above example, catch an API error in Google Docs/Drive.

Another type of error we could handle better: the authorization issue (ScriptError: Authorization). As Tyler pointed out, that one isn’t about a Google Docs problem, that’s about the user being logged in incorrectly