Added support for router specific error handler
Related open issues: #308
I have added support for router-specific error handlers, with a view to support router-specific not found handlers if this PR is successful. Slight changes have also been made to the docs to reflect the new feature. All current branch tests pass so I don't believe there are any breaking changes in this request.
~~I do note though that in the throw method on Response because the error handlers were not originally called in a return statement the control is still passed to middleware and in some instances breaks the expected behaviour of the error handler itself. For this reason I have also made a change to this method to preserve the expected behaviour of the error handler.~~
If this is a PR that will be accepted I do plan to add tests using supertest and jest (purely to simplify the testing for myself) to ensure the error handlers behave as expected. As mentioned above, I believe there is a natural progression here to add support for router-specific not found handlers and again if this PR is accepted I will look to continue in this direction. A small demo can be found here
EDIT: The earlier encountered problem with the Response.throw method was an artifact of my tsconfig in the demo. I have reverted this change and updated the demo repo.