mirror of
https://github.com/webrecorder/pywb.git
synced 2025-03-15 00:03:28 +01:00
* Improve handling of exceptions in wsgi_wrappers, fixes #219 * Update Common Crawl public data set location
This commit is contained in:
parent
29da503321
commit
3e8e590c1b
@ -86,7 +86,19 @@ class WSGIApp(object):
|
||||
error_view = self.wb_router.error_view
|
||||
|
||||
if hasattr(exc, 'status'):
|
||||
status = exc.status()
|
||||
if callable(exc.status):
|
||||
status = exc.status()
|
||||
else:
|
||||
status = exc.status
|
||||
# wsgi requires status
|
||||
# - to have at least 4 characters and
|
||||
# - to start with a number / integer
|
||||
if type(status) == int:
|
||||
status = '{} Exception {}'.format(status, type(exc).__name__)
|
||||
elif type(status) == str and status[0].isdigit():
|
||||
pass
|
||||
else:
|
||||
status = '500 Internal Server Error'
|
||||
else:
|
||||
status = '500 Internal Server Error'
|
||||
|
||||
@ -96,7 +108,7 @@ class WSGIApp(object):
|
||||
err_url = None
|
||||
|
||||
if len(exc.args):
|
||||
err_msg = exc.args[0]
|
||||
err_msg = str(exc.args[0])
|
||||
|
||||
if print_trace:
|
||||
import traceback
|
||||
@ -125,7 +137,7 @@ class WSGIApp(object):
|
||||
|
||||
#msg = msg.encode('utf-8', 'ignore')
|
||||
return WbResponse.text_response(msg,
|
||||
status=status)
|
||||
status=status)
|
||||
|
||||
#=================================================================
|
||||
DEFAULT_CONFIG_FILE = 'config.yaml'
|
||||
|
@ -166,7 +166,7 @@ def seek_read_full(seekable_reader, offset):
|
||||
def test_s3_read_1():
|
||||
pytest.importorskip('boto')
|
||||
|
||||
res = BlockLoader().load('s3://aws-publicdatasets/common-crawl/crawl-data/CC-MAIN-2015-11/segments/1424936462700.28/warc/CC-MAIN-20150226074102-00159-ip-10-28-5-156.ec2.internal.warc.gz',
|
||||
res = BlockLoader().load('s3://commoncrawl/crawl-data/CC-MAIN-2015-11/segments/1424936462700.28/warc/CC-MAIN-20150226074102-00159-ip-10-28-5-156.ec2.internal.warc.gz',
|
||||
offset=53235662,
|
||||
length=2526)
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user