An exception can simply be handled by putting your code in the
try/catch block. You can refer to the API documentation to see the exceptions a method throws. We've designed it so because:
- We don't want to tie you down to a default error handler;
- Error handling scripts in some instances may be an overkill;
- We want to give you freedom to choose whether you want to include an error handler script/add-on/middleware or not;
- We want you to be able to choose an error handler that best fits your project's needs.
However, should you need an error handler, we've created a PSR-15 / PSR-7 compatible Whoops Error Handler middleware that you can easily plug into your projects. You can use this middleware to handle errors globally, or locally (i.e. specific to the middleware batches you run).