---
title: onError
framework: tvmljs
role: symbol
role_heading: Instance Property
path: tvmljs/app/1627353-onerror
---

# onError

A callback function that is automatically called when an error is sent from the Apple TV.

## Declaration

```data
attribute function onError;
```

## Discussion

Discussion Use the onError attribute to handle any errors sent from the Apple TV. This attribute must be set to the following function: App.onError = function (message, sourceURL, line) {}.  message—The error message. sourceURL—The URL for the TVMLKit JS file where the error occurred. Defaults to nil if the information is not available. line—The line in the TVMLKit JS file where the error occurred. Defaults to nil if the information is not available.

## See Also

### Responding to App Life Cycle Events

- [onExit](tvmljs/app/1627419-onexit.md)
- [onLaunch](tvmljs/app/1627407-onlaunch.md)
- [onResume](tvmljs/app/1627415-onresume.md)
- [onSuspend](tvmljs/app/1627431-onsuspend.md)
