Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/internations/exceptionbundle
Helps making your Symfony Bundle a good Exception citizen. Yes, it’s opinionated.
https://github.com/internations/exceptionbundle
Last synced: 9 days ago
JSON representation
Helps making your Symfony Bundle a good Exception citizen. Yes, it’s opinionated.
- Host: GitHub
- URL: https://github.com/internations/exceptionbundle
- Owner: InterNations
- Created: 2012-12-18T14:28:51.000Z (almost 12 years ago)
- Default Branch: master
- Last Pushed: 2023-02-27T12:06:34.000Z (over 1 year ago)
- Last Synced: 2024-08-09T07:27:10.911Z (3 months ago)
- Language: PHP
- Homepage: http://www.internations.org
- Size: 73.2 KB
- Stars: 21
- Watchers: 40
- Forks: 2
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# ExceptionBundle
[![Build Status](https://travis-ci.org/InterNations/ExceptionBundle.svg)](https://travis-ci.org/InterNations/ExceptionBundle)
## 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?
- 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
### 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`
```php
debug) {
$bundles[] = new InterNations\Bundle\ExceptionBundle\InterNationsExceptionBundle();
}
}
}
```