Class UserError
Оптимизируйте свои подборки
Сохраняйте и классифицируйте контент в соответствии со своими настройками.
Ошибка пользователя Ошибка, которая отображается пользователям соединителя.
const cc = DataStudioApp.createCommunityConnector();
cc.newUserError()
.setText('This is the debug error text.')
.setDebugText('This text is only shown to admins.')
.throwException();
Подробная документация
print Json()
Печатает JSON-представление этого объекта. Это только для отладки.
Возвращаться
String
set Debug Text(text)
Устанавливает текст ошибки отладки, который отображается только администраторам.
Параметры
Имя | Тип | Описание |
---|
text | String | Текст ошибки. |
Возвращаться
User Error
— этот объект для цепочки.
set Text(text)
Устанавливает текст пользовательской ошибки.
Параметры
Имя | Тип | Описание |
---|
text | String | Текст ошибки. |
Возвращаться
User Error
— этот объект для цепочки.
throw Exception()
Запускает создание этого исключения.
Если не указано иное, контент на этой странице предоставляется по лицензии Creative Commons "С указанием авторства 4.0", а примеры кода – по лицензии Apache 2.0. Подробнее об этом написано в правилах сайта. Java – это зарегистрированный товарный знак корпорации Oracle и ее аффилированных лиц.
Последнее обновление: 2025-07-24 UTC.
[null,null,["Последнее обновление: 2025-07-24 UTC."],[[["\u003cp\u003e\u003ccode\u003eUserError\u003c/code\u003e is a class representing errors displayed to users of a connector in DataStudio.\u003c/p\u003e\n"],["\u003cp\u003eThis class provides methods to set user-facing error messages and debug messages for administrators.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003eUserError\u003c/code\u003e includes a \u003ccode\u003ethrowException()\u003c/code\u003e method to trigger the error, halting execution.\u003c/p\u003e\n"],["\u003cp\u003eMethods like \u003ccode\u003esetText()\u003c/code\u003e and \u003ccode\u003esetDebugText()\u003c/code\u003e facilitate customization of error messages, supporting both user and admin perspectives.\u003c/p\u003e\n"]]],["The `UserError` class allows developers to create and manage errors displayed to users of a data connector. Key actions include setting the user-facing error message using `setText()`, setting a separate admin-only debug message with `setDebugText()`, and triggering the error to be thrown using `throwException()`. The `printJson()` function outputs a JSON representation for debugging. Both `setText` and `setDebugText` can be chained.\n"],null,["# Class UserError\n\nUserError\n\nAn error that is shown to users of the connector.\n\n```javascript\nconst cc = DataStudioApp.createCommunityConnector();\n\ncc.newUserError()\n .setText('This is the debug error text.')\n .setDebugText('This text is only shown to admins.')\n .throwException();\n``` \n\n### Methods\n\n| Method | Return type | Brief description |\n|---------------------------------------------|----------------|------------------------------------------------------------------|\n| [printJson()](#printJson()) | `String` | Prints the JSON representation of this object. |\n| [setDebugText(text)](#setDebugText(String)) | [UserError](#) | Sets the text of the debug error, which is only shown to admins. |\n| [setText(text)](#setText(String)) | [UserError](#) | Sets the text of the user error. |\n| [throwException()](#throwException()) | `void` | Triggers this exception to be thrown. |\n\nDetailed documentation\n----------------------\n\n### `print``Json()`\n\nPrints the JSON representation of this object. This is for debugging only.\n\n#### Return\n\n\n`String`\n\n*** ** * ** ***\n\n### `set``Debug``Text(text)`\n\nSets the text of the debug error, which is only shown to admins.\n\n#### Parameters\n\n| Name | Type | Description |\n|--------|----------|-----------------|\n| `text` | `String` | The error text. |\n\n#### Return\n\n\n[UserError](#) --- This object, for chaining.\n\n*** ** * ** ***\n\n### `set``Text(text)`\n\nSets the text of the user error.\n\n#### Parameters\n\n| Name | Type | Description |\n|--------|----------|-----------------|\n| `text` | `String` | The error text. |\n\n#### Return\n\n\n[UserError](#) --- This object, for chaining.\n\n*** ** * ** ***\n\n### `throw``Exception()`\n\nTriggers this exception to be thrown."]]