You can debug your Community Connector in two ways:
- Enabling extended error messages
- Logging relevant execution data
This guide outlines how to make effective use of these capabilities.
Enabling/disabling debug features
isAdminUser() should return
true if the current user should see debug
messages and stack traces. If
isAdminUser() returns false, or is not defined,
and an error occurs, the user will see a generic error message.
isAdminUser()so it always returns
getEffectiveUser()in combination with an email whitelist of trusted users to easily add or remove users that should see the full error details. This can be especially useful if a user runs into an error that you have trouble reproducing.
- Make liberal use of
newDebugError()for invariants that should hold true. This can help with narrowing down problems in the future.
Apps Script logging
Apps Script provides different mechanisms for logging including the built-in Apps Script Logger, Stackdriver Logging, and Stackdriver Error Reporting. You can also try logging to a Google Sheet. Proactive logging can help to quickly narrow in on the cause of bugs, though care should be taken to not log sensative user data.