From 8449647c5f1bb61476a9101b9c195ca2fb08ddce Mon Sep 17 00:00:00 2001 From: Ilya Kreymer Date: Sun, 11 Jan 2015 23:53:34 -0800 Subject: [PATCH] wbexception: remove unused status in WbException, set default error for any uncaught exception to 500, instead of 400 --- pywb/framework/test/test_wsgi_wrapper.py | 6 +++--- pywb/framework/wsgi_wrappers.py | 2 +- pywb/utils/wbexception.py | 5 +++-- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/pywb/framework/test/test_wsgi_wrapper.py b/pywb/framework/test/test_wsgi_wrapper.py index e46cded5..39da76c2 100644 --- a/pywb/framework/test/test_wsgi_wrapper.py +++ b/pywb/framework/test/test_wsgi_wrapper.py @@ -14,7 +14,7 @@ class TestOkApp: class TestErrApp: def __call__(self, env): - raise Exception('Test Error') + raise Exception('Test Unexpected Error') class TestCustomErrApp: def __call__(self, env): @@ -41,8 +41,8 @@ def test_err_app(): testapp = webtest.TestApp(the_app) resp = testapp.get('/abc', expect_errors=True) - assert resp.status_int == 400 - assert '400 Bad Request Error: Test Error' in resp.body + assert resp.status_int == 500 + assert '500 Internal Server Error Error: Test Unexpected Error' in resp.body def test_custom_err_app(): the_app = init_app(initer(TestCustomErrApp), load_yaml=False) diff --git a/pywb/framework/wsgi_wrappers.py b/pywb/framework/wsgi_wrappers.py index cbd3825d..fdc96fb7 100644 --- a/pywb/framework/wsgi_wrappers.py +++ b/pywb/framework/wsgi_wrappers.py @@ -118,7 +118,7 @@ class WSGIApp(object): if hasattr(exc, 'status'): status = exc.status() else: - status = '400 Bad Request' + status = '500 Internal Server Error' if hasattr(exc, 'url'): err_url = exc.url diff --git a/pywb/utils/wbexception.py b/pywb/utils/wbexception.py index b94a6313..24e34f73 100644 --- a/pywb/utils/wbexception.py +++ b/pywb/utils/wbexception.py @@ -6,8 +6,9 @@ class WbException(Exception): Exception.__init__(self, msg) self.url = url - def status(self): - return '500 Internal Server Error' +# Default Error Code +# def status(self): +# return '500 Internal Server Error' #=================================================================