# ExecutionError

- [JSON representation](https://developers.google.com/apps-script/api/reference/rest/v1/ExecutionError#SCHEMA_REPRESENTATION)
- [ScriptStackTraceElement](https://developers.google.com/apps-script/api/reference/rest/v1/ExecutionError#ScriptStackTraceElement)
  - [JSON representation](https://developers.google.com/apps-script/api/reference/rest/v1/ExecutionError#ScriptStackTraceElement.SCHEMA_REPRESENTATION)

An 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 `https://developers.google.com/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 `https://developers.google.com/apps-script/api/reference/rest/v1/scripts/run#body.Operation.FIELDS.error` field contains a `https://developers.google.com/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.

| JSON representation |
|---|
| ``` { "scriptStackTraceElements": [ { object (`https://developers.google.com/apps-script/api/reference/rest/v1/ExecutionError#ScriptStackTraceElement`) } ], "errorMessage": string, "errorType": string } ``` |

| Fields ||
|---|---|
| `scriptStackTraceElements[]` | ``object (`https://developers.google.com/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. |
| `errorMessage` | `string` The error message thrown by Apps Script, usually localized into the user's language. |
| `errorType` | `string` The error type, for example `TypeError` or `ReferenceError`. If the error type is unavailable, this field is not included. |

## ScriptStackTraceElement

A stack trace through the script that shows where the execution failed.

| JSON representation |
|---|
| ``` { "function": string, "lineNumber": integer } ``` |

| Fields ||
|---|---|
| `function` | `string` The name of the function that failed. |
| `lineNumber` | `integer` The line number where the script failed. |