ExecutionError
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
一个对象,用于提供因尝试使用 Apps Script API 尝试执行脚本函数而导致的错误性质的相关信息。如果 run
调用成功,但脚本函数(或 Apps 脚本本身)抛出异常,则响应正文的 error
字段会包含 Status
对象。Status
对象的 details
字段包含一个数组,该数组中包含一个 ExecutionError
对象。
JSON 表示法 |
{
"scriptStackTraceElements": [
{
object (ScriptStackTraceElement )
}
],
"errorMessage": string,
"errorType": string
} |
字段 |
scriptStackTraceElements[] |
object (ScriptStackTraceElement )
一组对象,通过脚本提供堆栈轨迹,显示执行失败的位置,最深层的调用最先进行。
|
errorMessage |
string
Apps 脚本抛出的错误消息,通常本地化为用户的语言。
|
errorType |
string
错误类型,例如 TypeError 或 ReferenceError 。如果错误类型不可用,则不包含此字段。
|
ScriptStackTraceElement
JSON 表示法 |
{
"function": string,
"lineNumber": integer
} |
字段 |
function |
string
失败的函数的名称。
|
lineNumber |
integer
脚本运行失败的行号。
|
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-07-26。
[null,null,["最后更新时间 (UTC):2025-07-26。"],[[["\u003cp\u003e\u003ccode\u003eExecutionError\u003c/code\u003e objects provide information about errors during script execution via the Apps Script API.\u003c/p\u003e\n"],["\u003cp\u003eThese objects contain details such as stack trace elements, error message, and error type.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003eScriptStackTraceElement\u003c/code\u003e objects offer a stack trace showing the location of the execution failure within the script.\u003c/p\u003e\n"],["\u003cp\u003eThey include the function name and line number where the error occurred.\u003c/p\u003e\n"]]],[],null,["# ExecutionError\n\n- [JSON representation](#SCHEMA_REPRESENTATION)\n- [ScriptStackTraceElement](#ScriptStackTraceElement)\n - [JSON representation](#ScriptStackTraceElement.SCHEMA_REPRESENTATION)\n\nAn object that provides information about the nature of an error resulting from an attempted execution of a script function using the Apps Script API. If a [run](/apps-script/api/reference/rest/v1/scripts/run#google.apps.script.v1.ScriptExecution.Execute) call succeeds but the script function (or Apps Script itself) throws an exception, the response body's [error](/apps-script/api/reference/rest/v1/scripts/run#body.Operation.FIELDS.error) field contains a [Status](/apps-script/api/reference/rest/v1/scripts/run#Status) object. The `Status` object's `details` field contains an array with a single one of these `ExecutionError` objects.\n\n| JSON representation |\n|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| ``` { \"scriptStackTraceElements\": [ { object (/apps-script/api/reference/rest/v1/ExecutionError#ScriptStackTraceElement) } ], \"errorMessage\": string, \"errorType\": string } ``` |\n\n| Fields ||\n|------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `scriptStackTraceElements[]` | `object (`[ScriptStackTraceElement](/apps-script/api/reference/rest/v1/ExecutionError#ScriptStackTraceElement)`)` An array of objects that provide a stack trace through the script to show where the execution failed, with the deepest call first. |\n| `errorMessage` | `string` The error message thrown by Apps Script, usually localized into the user's language. |\n| `errorType` | `string` The error type, for example `TypeError` or `ReferenceError`. If the error type is unavailable, this field is not included. |\n\nScriptStackTraceElement\n-----------------------\n\nA stack trace through the script that shows where the execution failed.\n\n| JSON representation |\n|-------------------------------------------------------|\n| ``` { \"function\": string, \"lineNumber\": integer } ``` |\n\n| Fields ||\n|--------------|----------------------------------------------------|\n| `function` | `string` The name of the function that failed. |\n| `lineNumber` | `integer` The line number where the script failed. |"]]