Skip to content

Commit 8449647

Browse files
committed
wbexception: remove unused status in WbException, set default error for
any uncaught exception to 500, instead of 400
1 parent 7610d9d commit 8449647

File tree

3 files changed

+7
-6
lines changed

3 files changed

+7
-6
lines changed

pywb/framework/test/test_wsgi_wrapper.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ def response(env, start_response):
1414

1515
class TestErrApp:
1616
def __call__(self, env):
17-
raise Exception('Test Error')
17+
raise Exception('Test Unexpected Error')
1818

1919
class TestCustomErrApp:
2020
def __call__(self, env):
@@ -41,8 +41,8 @@ def test_err_app():
4141
testapp = webtest.TestApp(the_app)
4242
resp = testapp.get('/abc', expect_errors=True)
4343

44-
assert resp.status_int == 400
45-
assert '400 Bad Request Error: Test Error' in resp.body
44+
assert resp.status_int == 500
45+
assert '500 Internal Server Error Error: Test Unexpected Error' in resp.body
4646

4747
def test_custom_err_app():
4848
the_app = init_app(initer(TestCustomErrApp), load_yaml=False)

pywb/framework/wsgi_wrappers.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ def handle_exception(self, env, exc, print_trace):
118118
if hasattr(exc, 'status'):
119119
status = exc.status()
120120
else:
121-
status = '400 Bad Request'
121+
status = '500 Internal Server Error'
122122

123123
if hasattr(exc, 'url'):
124124
err_url = exc.url

pywb/utils/wbexception.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,9 @@ def __init__(self, msg=None, url=None):
66
Exception.__init__(self, msg)
77
self.url = url
88

9-
def status(self):
10-
return '500 Internal Server Error'
9+
# Default Error Code
10+
# def status(self):
11+
# return '500 Internal Server Error'
1112

1213

1314
#=================================================================

0 commit comments

Comments
 (0)