1
0
mirror of https://github.com/webrecorder/pywb.git synced 2025-03-15 00:03:28 +01:00

wbexception: remove unused status in WbException, set default error for

any uncaught exception to 500, instead of 400
This commit is contained in:
Ilya Kreymer 2015-01-11 23:53:34 -08:00
parent 7610d9deb7
commit 8449647c5f
3 changed files with 7 additions and 6 deletions

View File

@ -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)

View File

@ -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

View File

@ -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'
#=================================================================