Tetap teratur dengan koleksi
Simpan dan kategorikan konten berdasarkan preferensi Anda.
Anda dapat men-debug Konektor Komunitas dengan dua cara:
Mengaktifkan pesan error yang diperluas
Mencatat data eksekusi yang relevan ke dalam log
Panduan ini menguraikan cara menggunakan kemampuan tersebut secara efektif.
Mengaktifkan/menonaktifkan fitur debug
isAdminUser() harus menampilkan true jika pengguna saat ini harus melihat pesan
debug dan pelacakan tumpukan. Jika isAdminUser() menampilkan nilai salah (false), atau tidak ditentukan,
dan terjadi error, pengguna akan melihat pesan error umum.
Tips Proses Debug
Desain isAdminUser() agar selalu menampilkan true untuk developer.
Gunakan getEffectiveUser() bersama dengan daftar aman email pengguna tepercaya untuk menambahkan atau menghapus pengguna yang seharusnya melihat detail error lengkap dengan mudah.
Hal ini dapat sangat berguna jika pengguna mengalami error yang
sulit Anda reproduksi.
Gunakan newDebugError() secara bebas untuk invarian yang harus bernilai benar. Hal ini dapat membantu mempersempit masalah di masa mendatang.
[null,null,["Terakhir diperbarui pada 2025-07-25 UTC."],[[["\u003cp\u003eCommunity Connectors can be debugged by enabling extended error messages or logging execution data.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003eisAdminUser()\u003c/code\u003e function controls debug message visibility, returning \u003ccode\u003etrue\u003c/code\u003e for users who should see them and \u003ccode\u003efalse\u003c/code\u003e otherwise.\u003c/p\u003e\n"],["\u003cp\u003eLeverage Apps Script's logging mechanisms, such as the built-in Logger, Stackdriver, or even a Google Sheet, to proactively identify and resolve bugs while protecting user data privacy.\u003c/p\u003e\n"],["\u003cp\u003eDesigning \u003ccode\u003eisAdminUser()\u003c/code\u003e to always return \u003ccode\u003etrue\u003c/code\u003e for developers and using \u003ccode\u003egetEffectiveUser()\u003c/code\u003e with a safelist can aid in debugging and reproducing user errors.\u003c/p\u003e\n"]]],[],null,["You can debug your Community Connector in two ways:\n\n1. Enabling extended error messages\n2. Logging relevant execution data\n\nThis guide outlines how to make effective use of these capabilities.\n\nEnabling/disabling debug features\n\n`isAdminUser()` should return `true` if the current user should see debug\nmessages and stack traces. If `isAdminUser()` returns false, or is not defined,\nand an error occurs, the user will see a generic error message.\n| **Note:** Use `newUserError()` if users should see the error message regardless of the `isAdminUser()` response.\n\nDebugging Tips\n\n- Design `isAdminUser()` so it always returns `true` for developers.\n- Use [`getEffectiveUser()`](/apps-script/reference/base/session#getEffectiveUser()) in combination with an email safelist 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.\n- Make liberal use of [`newDebugError()`](/apps-script/reference/data-studio/community-connector#newDebugError()) for invariants that should hold true. This can help with narrowing down problems in the future.\n\nApps Script logging\n\nApps Script provides [different mechanisms for logging](/apps-script/guides/logging) including the built-in\n[Apps Script Logger](https://developers.google.com/apps-script/reference/base/logger), [Stackdriver Logging](https://developers.google.com/apps-script/guides/logging#stackdriver_logging), and [Stackdriver Error Reporting](https://developers.google.com/apps-script/guides/logging#stackdriver_error_reporting).\nYou can also try [logging to a Google Sheet](https://developers.google.com/apps-script/reference/spreadsheet/spreadsheet-app). Proactive logging can help to\nquickly narrow in on the cause of bugs, though care should be taken to not log\nsensitive user data."]]