New in Symfony 2.6: Error page previews
User Experience (UX) has become an essential part of web application development. One of the most important elements of UX is to provide comprehensible and helpful error pages in case things don't work as expected.
Developing and designing these error pages in previous Symfony versions was a bit involved because it required to trigger an exception with the exact HTTP code needed and you had to make the exception controller use the right template.
That's why Symfony 2.6 will include a new option to preview error pages.
Specifically, TwigBundle now contains a routing file that you can import from
1 2 3 4
# app/config/routing_dev.yml _errors: resource: "@TwigBundle/Resources/config/routing/errors.xml" prefix: /_error
Once these new routes are loaded, you can preview any error page using these special URLs:
statusCode corresponds to the HTTP Status Code of the error and the
format option defaults to
html and accepts any valid request format,
To learn more about customizing your error pages, read the revamped cookbook article about How to Customize Error Pages. Now it's time to test this feature and don't forget to leave a link to your beautiful error page in the comments of this article!
Note: this post was mostly written by Matthias Pigulla.
Comments are closed.
To ensure that comments stay relevant, they are closed for old posts.