2017 © Pedro Peláez
 

symfony-bundle exceptions-bundle

A simple controller to display error pages during development plus some building blocks for more user-friendly error pages.

image

webfactory/exceptions-bundle

A simple controller to display error pages during development plus some building blocks for more user-friendly error pages.

  • Tuesday, January 19, 2016
  • by webfactory
  • Repository
  • 14 Watchers
  • 62 Stars
  • 523,741 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 13 Forks
  • 5 Open issues
  • 31 Versions
  • 3 % Grown

The README.md

WebfactoryExceptionsBundle

A Symfony Bundle with some Twig templates and blocks to create helpful, user friendly error pages., (*1)

⚠️ Please note: At webfactory, we do no longer use this bundle in new projects, since its main functionality was merged into Symfony 2.6 and we prefer to have project-specific templates. However, we still use the wording that we provide with this bundle., (*2)

Basic Usage

First, follow the Symfony Documentation to learn how to create and preview custom error pages. Been there, done that? Fine!, (*3)

Let's say your generic error page extends the base layout of MyWebsiteBundle. Then you may want to have your error.html.twig to look something like this:, (*4)

{# error.html.twig #}
{% extends '@MyWebsite/Layout/base.html.twig' %}
{% use '@WebfactoryExceptions/Exception/blocks.html.twig' %}

{% block myMainContentContainer %}
    {{ block('webfactory_exceptions_standardExceptionPage') }}
{% endblock %}

The webfactory_exceptions_standardExceptionPage block has headings, the translated exception description and provides the user with a list of alternatives what they can do next: get back (simulating a browser back), get to the homepage, get to the contact page or google the domain. It may look like this:, (*5)

Sample rendering of the webfactory_exceptions_standardExceptionPage block, (*6)

A default block in the bundle provides a link to the homepage with the default target /. If your application does not start at /, you need to set the variable homepageUrl., (*7)

Also, you may want to set the variable contactUrl to get a link to your contact page in the listed alternatives., (*8)

{# error.html.twig #}
{% extends '@MyWebsite/Layout/base.html.twig' %}
{% use '@WebfactoryExceptions/Exception/blocks.html.twig' %}

{% set homepageUrl = "https://www.webfactory.de" %}
{% set contactUrl = path('name_of_a_route') %}

{# your blocks and definitions... #}

Filling in Blocks of Base Layouts

If your base layout already features blocks you need to fill with exception specific content, you can do it this way:, (*9)

{# error.html.twig #}
{% extends '@MyWebsite/Layout/base.html.twig' %}

{% use '@WebfactoryExceptions/Exception/blocks.html.twig' with
        webfactory_exceptions_error_title as title,
        webfactory_exceptions_error_headline as stage_headline
%}

This loads the webfactory_exceptions_error_title block directly into the title block of your base layout, as well as the webfactory_exceptions_error_headline block into the stage_headline block., (*10)

Happy error-styling!, (*11)

This bundle was started at webfactory GmbH, Bonn. It was inspired by the blog post How Symfony2 turns exceptions into error pages and how to customize those., (*12)

Previous releases of this bundle contained extra code that would help during development to preview your error pages. This code, however, could be merged into the Symfony core in Symfony 2.6, so we could finally remove it from this bundle. Read the announcement when you're interested in historic details., (*13)

Copyright 2012-2022 webfactory GmbH, Bonn. Code released under the MIT license., (*14)

The Versions

19/01 2016

dev-master

9999999-dev http://inside.webfactory.de/de/blog/symfony2-exception-handling-and-custom-error-pages-explained.html

A simple controller to display error pages during development plus some building blocks for more user-friendly error pages.

  Sources   Download

MIT

The Requires

 

The Development Requires

19/01 2016

4.3.0

4.3.0.0 http://inside.webfactory.de/de/blog/symfony2-exception-handling-and-custom-error-pages-explained.html

A simple controller to display error pages during development plus some building blocks for more user-friendly error pages.

  Sources   Download

MIT

The Requires

 

The Development Requires

16/10 2015

4.2.0

4.2.0.0 http://inside.webfactory.de/de/blog/symfony2-exception-handling-and-custom-error-pages-explained.html

A simple controller to display error pages during development plus some building blocks for more user-friendly error pages.

  Sources   Download

MIT

The Requires

 

The Development Requires

22/05 2015

4.1.0

4.1.0.0 http://inside.webfactory.de/de/blog/symfony2-exception-handling-and-custom-error-pages-explained.html

A simple controller to display error pages during development plus some building blocks for more user-friendly error pages.

  Sources   Download

MIT

The Requires

 

The Development Requires

07/01 2015

dev-23_route_name

dev-23_route_name http://inside.webfactory.de/de/blog/symfony2-exception-handling-and-custom-error-pages-explained.html

A simple controller to display error pages during development plus some building blocks for more user-friendly error pages.

  Sources   Download

MIT

The Requires

 

The Development Requires

07/01 2015

4.0.5

4.0.5.0 http://inside.webfactory.de/de/blog/symfony2-exception-handling-and-custom-error-pages-explained.html

A simple controller to display error pages during development plus some building blocks for more user-friendly error pages.

  Sources   Download

MIT

The Requires

 

The Development Requires

19/11 2014

4.0.4

4.0.4.0 http://inside.webfactory.de/de/blog/symfony2-exception-handling-and-custom-error-pages-explained.html

A simple controller to display error pages during development plus some building blocks for more user-friendly error pages.

  Sources   Download

MIT

The Requires

 

The Development Requires

19/09 2014

4.0.3

4.0.3.0 http://inside.webfactory.de/de/blog/symfony2-exception-handling-and-custom-error-pages-explained.html

A simple controller to display error pages during development plus some building blocks for more user-friendly error pages.

  Sources   Download

MIT

The Requires

 

The Development Requires

17/08 2014

4.0.2

4.0.2.0 http://inside.webfactory.de/de/blog/symfony2-exception-handling-and-custom-error-pages-explained.html

A simple controller to display error pages during development plus some building blocks for more user-friendly error pages.

  Sources   Download

MIT

The Requires

 

The Development Requires

16/08 2014

4.0.1

4.0.1.0 http://inside.webfactory.de/de/blog/symfony2-exception-handling-and-custom-error-pages-explained.html

A simple controller to display error pages during development plus some building blocks for more user-friendly error pages.

  Sources   Download

MIT

The Requires

 

The Development Requires

30/04 2014

4.0.0

4.0.0.0 http://inside.webfactory.de/de/blog/symfony2-exception-handling-and-custom-error-pages-explained.html

A simple controller to display error pages during development plus some building blocks for more user-friendly error pages.

  Sources   Download

MIT

The Requires

 

The Development Requires

13/02 2014

3.1.0

3.1.0.0 http://inside.webfactory.de/de/blog/symfony2-exception-handling-and-custom-error-pages-explained.html

A simple controller to display error pages during development plus some building blocks for more user-friendly error pages.

  Sources   Download

MIT

The Requires

 

16/04 2013

3.0.1

3.0.1.0

  Sources   Download

19/03 2013

3.0.0

3.0.0.0

  Sources   Download

19/02 2013

2.0.1

2.0.1.0

  Sources   Download

18/02 2013

2.0.0

2.0.0.0

  Sources   Download

15/02 2013

2.0.x-dev

2.0.9999999.9999999-dev

  Sources   Download

15/02 2013

1.0.13

1.0.13.0

  Sources   Download

12/02 2013

1.0.12

1.0.12.0

  Sources   Download

04/02 2013

1.0.11

1.0.11.0

  Sources   Download

14/11 2012

1.0.10

1.0.10.0

  Sources   Download

14/11 2012

1.0.9

1.0.9.0

  Sources   Download

29/08 2012

1.0.8

1.0.8.0

  Sources   Download

29/08 2012

1.0.7

1.0.7.0

  Sources   Download

29/08 2012

1.0.6

1.0.6.0

  Sources   Download

17/02 2012

1.0.5

1.0.5.0

  Sources   Download

17/02 2012

1.0.4

1.0.4.0

  Sources   Download

17/02 2012

1.0.3

1.0.3.0

  Sources   Download

17/02 2012

1.0.2

1.0.2.0

  Sources   Download

17/02 2012

1.0.1

1.0.1.0

  Sources   Download

17/02 2012

1.0.0

1.0.0.0

  Sources   Download