PHPackages                             internations/exception-bundle - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Debugging &amp; Profiling](/categories/debugging)
4. /
5. internations/exception-bundle

ActiveLibrary[Debugging &amp; Profiling](/categories/debugging)

internations/exception-bundle
=============================

Helps making your Symfony Bundle a good Exception citizen. Yes, it’s opinionated.

5.3.0(5y ago)2148.1k2[1 PRs](https://github.com/InterNations/ExceptionBundle/pulls)MITPHPPHP &gt;=7.1

Since Apr 3Pushed 3y ago38 watchersCompare

[ Source](https://github.com/InterNations/ExceptionBundle)[ Packagist](https://packagist.org/packages/internations/exception-bundle)[ RSS](/packages/internations-exception-bundle/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (7)Versions (18)Used By (0)

ExceptionBundle
===============

[](#exceptionbundle)

[![Build Status](https://camo.githubusercontent.com/200bb06d1fff2876e715ea7ae5c15a6a04e9cfde0280ac816a6dc73a6e0949b1/68747470733a2f2f7472617669732d63692e6f72672f496e7465724e6174696f6e732f457863657074696f6e42756e646c652e737667)](https://travis-ci.org/InterNations/ExceptionBundle)

Clean exception handling for your Symfony 2 bundles
---------------------------------------------------

[](#clean-exception-handling-for-your-symfony-2-bundles)

`ExceptionBundle` helps you managing the exceptions of your bundle:

- Generate exception subclasses from command line including a marker interface
- Replace all global throw statements in a bundle with bundle specific exception classes

Why should you care?
--------------------

[](#why-should-you-care)

- The simpler exceptions are distinguishable by type, the simpler exceptional conditions are handled
- Providing a marker interface all bundle exception classes implement allows clients to dramatically simplify exception handling
- Usually, creating all the exception sub classes by hand is cumbersome, `ExceptionBundle` can help you

Usage
-----

[](#usage)

### Generate bundle specific exception subclasses

[](#generate-bundle-specific-exception-subclasses)

This command will generate a bunch of exceptions

```
php app/console exception:generate app/src/MyVendor/MyBundle "MyVendor\MyBundle" ExceptionInterface RuntimeException DomainException

```

`ls app/src/MyVendor/MyBundle/Exception`

```
ExceptionInterface.php  RuntimeException.php  DomainException.php

```

`cat app/src/MyVendor/MyBundle/Exception/RuntimeException.php`

```
