# Create custom error handler

**URL:** <https://discourse.slimframework.com/t/create-custom-error-handler/1583>\
**Category:** Questions\
**Created:** [June 16, 2017, 4:12am UTC](https://discourse.slimframework.com/t/create-custom-error-handler/1583 "2017-06-16T04:12:51Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![aneek](https://avatars.discourse-cdn.com/v4/letter/a/a8b319/32.png) [@aneek](https://discourse.slimframework.com/u/aneek)\
**Post date:** [June 16, 2017, 4:12am UTC](https://discourse.slimframework.com/t/create-custom-error-handler/1583/1 "2017-06-16T04:12:51Z")

</div>

Hello,

By following [https://www.slimframework.com/docs/handlers/error.html](https://www.slimframework.com/docs/handlers/error.html) this link, I am able to override the existing error handlers in Slim.  
In \Slim\App::handleException() I see there are 3 which are registered. In my project I want to introduce 2 new error handlers like:

- badRequestHandler - to show 400 Bad Request and to log each bad request to logger.

- tooManyRequestHandler - to show 429 Too Many Request as a result of rate limitations.

Is there a way to do this? Do I have to override ‘protected function handleException’ for this?

Regards,  
Aneek
