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

error reporting: ensure NotFoundException used for replay not found errors!

This commit is contained in:
Ilya Kreymer 2018-03-02 17:36:14 -08:00 committed by John Berlin
parent 43537fead3
commit af3e9c6293
No known key found for this signature in database
GPG Key ID: 6EF5E4B442011B02
2 changed files with 9 additions and 2 deletions

View File

@ -358,7 +358,11 @@ class RewriterApp(object):
error = ''
details = dict(args=kwargs, error=error)
raise UpstreamException(r.status_code, url=wb_url.url, details=details)
if r.status_code == 404:
raise NotFoundException(url=wb_url.url, msg=details)
else:
raise UpstreamException(r.status_code, url=wb_url.url, details=details)
cdx = CDXObject(r.headers.get('Warcserver-Cdx').encode('utf-8'))

View File

@ -405,10 +405,13 @@ class TestWbIntegration(BaseConfigTest):
def test_replay_not_found(self, fmod):
fmod_slash = fmod + '/' if fmod else ''
resp = self.head('/pywb/{0}http://not-exist.example.com/', fmod_slash, status=404)
resp = self.get('/pywb/{0}http://not-exist.example.com/path?A=B', fmod_slash, status=404)
assert resp.content_type == 'text/html'
assert resp.status_int == 404
assert 'Url Not Found' in resp.text
assert 'The url <b>http://not-exist.example.com/path?A=B</b> could not be found in this collection.' in resp.text
def test_static_content(self):
resp = self.testapp.get('/static/default_banner.css')
assert resp.status_int == 200