Class UserError
用户错误
向连接器用户显示的错误。
const cc = DataStudioApp.createCommunityConnector();
cc.newUserError()
.setText('This is the debug error text.')
.setDebugText('This text is only shown to admins.')
.throwException();
详细文档
printJson()
输出此对象的 JSON 表示法。这仅用于调试。
返回
String
setDebugText(text)
设置调试错误的文本,该文本仅向管理员显示。
参数
返回
UserError
- 此对象,用于链式调用。
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2024-12-22。
[null,null,["最后更新时间 (UTC):2024-12-22。"],[[["`UserError` is a class representing errors displayed to users of a connector in DataStudio."],["This class provides methods to set user-facing error messages and debug messages for administrators."],["`UserError` includes a `throwException()` method to trigger the error, halting execution."],["Methods like `setText()` and `setDebugText()` facilitate customization of error messages, supporting both user and admin perspectives."]]],["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"]]