با مجموعهها، منظم بمانید
ذخیره و طبقهبندی محتوا براساس اولویتهای شما.
میتوانید به دو روش Community Connector خود را اشکالزدایی کنید:
فعال کردن پیام های خطای طولانی
ثبت داده های اجرایی مربوطه
این راهنما نحوه استفاده موثر از این قابلیت ها را تشریح می کند.
فعال/غیرفعال کردن ویژگی های اشکال زدایی
اگر کاربر فعلی پیامهای اشکالزدایی را ببیند و ردیابیهای پشته را ببیند isAdminUser() باید true برگرداند. اگر isAdminUser() false را برگرداند، یا تعریف نشده باشد، و خطایی رخ دهد، کاربر یک پیام خطای عمومی را مشاهده خواهد کرد.
نکات اشکال زدایی
isAdminUser() را طراحی کنید تا همیشه true برای توسعه دهندگان برگرداند.
از getEffectiveUser() در ترکیب با لیست امن ایمیل از کاربران قابل اعتماد استفاده کنید تا به راحتی کاربرانی را اضافه یا حذف کنید که باید جزئیات کامل خطا را ببینند. این می تواند به ویژه در صورتی مفید باشد که کاربر با خطایی مواجه شود که در بازتولید آن مشکل دارید.
استفاده آزادانه از newDebugError() برای متغیرهایی که باید درست باشند. این می تواند به کاهش مشکلات در آینده کمک کند.
تاریخ آخرین بهروزرسانی 2025-07-24 بهوقت ساعت هماهنگ جهانی.
[null,null,["تاریخ آخرین بهروزرسانی 2025-07-24 بهوقت ساعت هماهنگ جهانی."],[[["\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."]]