# Yaf_Dispatcher::setErrorHandler

(Yaf >=1.0.0)

Yaf_Dispatcher::setErrorHandler — Set error handler

### Description

public Yaf_Dispatcher::setErrorHandler ( call `$callback` , int `$error_types` ) : Yaf_Dispatcher

Set error handler for Yaf. when application.dispatcher.throwException is off, Yaf will trigger catchable error while unexpected errors occrred.

Thus, this error handler will be called while the error raise.

### Parameters

`callback`

  A callable callback

`error_types`

### Return Values

### See Also

- Yaf_Dispatcher::throwException() - Switch on/off exception throwing
- Yaf_Application::getLastErrorNo() - Get code of last occurred error
- Yaf_Application::getLastErrorMsg() - Get message of the last occurred error