added custom error handler

Move this line to `ErrorHandler::register` method. In this method just instantiate `ErrorHandler` and call `register` method.