# setOnError method

Warning note**DEPRECATED.**   
  
This API is deprecated and may be removed in a future version.

qlik.setOnError(onError, onWarning)

Registers a callback for error handling. Standard Qlik Sense error handling is used if this method is not called.

## Version history

Version history

| Version state | Details |
| --- | --- |
| Introduced | 1.0 |
| Updated | 2.1 |
| Deprecated | Qlik Sense February 2018<br><br>Use instead: [app.on()](https://help.qlik.com/en-US/sense-developer/November2024/Subsystems/APIs/Content/Sense_ClientAPIs/CapabilityAPIs/AppAPI/on-method.htm) or [global.on()](https://help.qlik.com/en-US/sense-developer/November2024/Subsystems/APIs/Content/Sense_ClientAPIs/CapabilityAPIs/GlobalAPI/on-method.htm) |

## Parameters

### onError

Type: Function

Error handling function

### onWarning

Type: Function

Optional.

Warning handling function.

Introduced in version 2.1.

## Example

```
qlik.setOnError(function(error) {
	//contains code, message
	alert(error.message);
},
function(warning){
	window.console.log(warning);
});
```

Tip noteSee Loading external and internal modules for more example of use.