mirror of
https://github.com/webrecorder/pywb.git
synced 2025-03-15 00:03:28 +01:00
IndexHandler: report BadRequestException as error while loading index (#625)
This commit is contained in:
parent
5d34018b9f
commit
106a9e9200
@ -92,7 +92,11 @@ class IndexHandler(object):
|
||||
errs = dict(last_exc=BadRequestException('output={0} not supported'.format(output)))
|
||||
return None, None, errs
|
||||
|
||||
cdx_iter, errs = self._load_index_source(params)
|
||||
cdx_iter = None
|
||||
try:
|
||||
cdx_iter, errs = self._load_index_source(params)
|
||||
except BadRequestException as e:
|
||||
errs = dict(last_exc=e)
|
||||
if not cdx_iter:
|
||||
return None, None, errs
|
||||
|
||||
|
@ -296,4 +296,12 @@ class TestCDXApp(BaseTestClass):
|
||||
assert resp.status_code == 400
|
||||
assert resp.json == {'message': 'output=foo not supported'}
|
||||
|
||||
def test_error_unknown_match_type(self):
|
||||
"""test unknown/unsupported matchType"""
|
||||
resp = self.query('http://www.iana.org/_css/2013.1/print.css',
|
||||
is_error=True,
|
||||
fields='urlkey,timestamp,status',
|
||||
matchType='foo')
|
||||
assert resp.status_code == 400
|
||||
assert resp.json == {'message': 'Invalid match_type: foo'}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user