User friendly exception handling with symfony

by Alvaro

The default behavior in symfony is that if an exception arises and is not handled then it will redirect the user to the error500.php page or show a stack trace. Even if is possible to override the error500.php page, we were in the need to provide custom messages to the user and also keep him inside the symfony application.

Multiple factors can make this problem to happen, like when the database server refuse our connection attempts or just because something went wrong in our php application. To overcome this issue we developed a plugin that tells the symfony exception handling mechanism to forward the user to a module/action specified in the configuration files.

In this way, we can keep with us all the benefits of the symfony rendering engine, all it’s helpers, etc.

The handler is made in such a way that we can specify a global default error action, or more detailed per module/action handlers. We can have all this coolness by just typing a few lines in the module.yml file or in the app.yml file :).

If you want to see the details of the usage please check the plugin page on the symfony website.

This entry was posted in Development. Bookmark the permalink.

One Response to User friendly exception handling with symfony

  1. batz says:

    useful post! thx

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Our Philosophy

Along with success comes a reputation for wisdom.

TheNetcircle In Pictures

IMG_8263IMG_8179IMG_8235IMG_8245IMG_8250IMG_8251

Latest Tweets

Join Our Team

Categories