Skip to content

Commit

Permalink
Added documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
jaytaph committed Nov 13, 2014
1 parent 3c198b7 commit d87eaf5
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
1 change: 1 addition & 0 deletions DependencyInjection/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ public function getConfigTreeBuilder()
->end()
->scalarNode('rate_response_exception')
->defaultNull()
->info('Optional exception class that will be returned when a client hits the rate limit')
->validate()
->always(function ($item) {
if (! is_subclass_of($item, '\Exception')) {
Expand Down
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,13 @@ class RateLimitGenerateKeyListener

Make sure to generate a key based on what is rate limited in your controllers.


## Throwing exceptions

Instead of returning a Response object when a rate limit has exceeded, it's also possible to throw an exception. This
allows you to easily handle the rate limit on another level, for instance by capturing the ``kernel.exception`` event.


## Running tests

If you want to run the tests use:
Expand Down

0 comments on commit d87eaf5

Please sign in to comment.