mitsuhiko/flask — pull request #839 by danielrichman (2013-08-17 23:20:04+00:00)
Title: Check error handlers for classes before HTTP status codes

This allows adding error handlers like this:

```python
@app.errorhandler(werkzeug.exceptions.Forbidden)
```

And subclassing HTTPExceptions:

```python
class ForbiddenBecauseReason(Forbidden): pass

@app.errorhandler(ForbiddenBecauseReason)
def error1():
return "Forbidden because reason", 403

@app.errorhandler(403)
def error2():
return "Forbidden", 403
```

... the idea being, that a flask extension might want to raise an exception, with the default behaviour of creating a HTTP error page, but still allowing the user to add a view/handler specific to that exception (e.g., "Forbidden because you are not in the right group").