Skip to content
Myr

Re-raise BuildError with traceback.

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Ron DuPlain · committed by Ron DuPlain · parent bb31188 · Browse files · 2 files+20 added−1 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

2 files+20 added−1 removed

  • other:+20 added−1 removed

2 files+20 added−1 removed

modified:flask/testsuite/basic.py+15 added
696 unmodified lines
697 'http://localhost/hello/test%20x')698699 def test_build_error_handler(self):700 app = flask.Flask(__name__)701702 # Test base case, a URL which results in a BuildError.703 with app.test_request_context():704 self.assertRaises(BuildError, flask.url_for, 'spam')705706 # Verify the error is re-raised if not the current exception.707 try:708 with app.test_request_context():709 flask.url_for('spam')710 except BuildError, error:711 pass712 try:713 raise RuntimeError('Test case where BuildError is not current.')714 except RuntimeError:715 self.assertRaises(BuildError, app.handle_build_error, error, 'spam')716717 # Test a custom handler.718 def handler(error, endpoint, **values):719 # Just a test.720 return '/test_handler/'721 app.build_error_handler = handler
452 unmodified lines
modified:flask/app.py+5 added-1 removed
1488 unmodified lines
14891490 Calls :attr:`build_error_handler` if it is not `None`.1491 """1492 if self.build_error_handler is None:1493 exc_type, exc_value, tb = sys.exc_info()1494 if exc_value is error:1495 raise exc_type, exc_value, tb1496 else:1493 raise error1497 raise error1498 return self.build_error_handler(error, endpoint, **values)14991500 def preprocess_request(self):1501 """Called before the actual request dispatching and will
183 unmodified lines