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:
parent
7610d9deb7
commit
8449647c5f
@ -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)
|
||||
|
@ -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
|
||||
|
@ -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'
|
||||
|
||||
|
||||
#=================================================================
|
||||
|
Loading…
x
Reference in New Issue
Block a user