Commit 2ec3c141 authored by Łukasz Nowak's avatar Łukasz Nowak

app: Avoid needless exception to pop

It's better to reply 400 Bad Request on malformed requests and do not pollute
log with exceptions.
parent f4d3ac63
...@@ -367,10 +367,12 @@ class Kedifa(object): ...@@ -367,10 +367,12 @@ class Kedifa(object):
if not index: if not index:
index = None index = None
else: else:
raise ValueError start_response('400 Bad Request', headers_text_plain)
return ('Wrong path',)
if not reference: if not reference:
raise ValueError start_response('400 Bad Request', headers_text_plain)
return ('Wrong path',)
if environ['REQUEST_METHOD'] == 'PUT': if environ['REQUEST_METHOD'] == 'PUT':
# key auth # key auth
......
...@@ -332,11 +332,11 @@ class KedifaIntegrationTest(KedifaMixinCaucase, unittest.TestCase): ...@@ -332,11 +332,11 @@ class KedifaIntegrationTest(KedifaMixinCaucase, unittest.TestCase):
# KeDiFa does not support nothing on / so for now it just raises # KeDiFa does not support nothing on / so for now it just raises
# possibly in the future it will become self-describing interface # possibly in the future it will become self-describing interface
self.assertEqual( self.assertEqual(
httplib.INTERNAL_SERVER_ERROR, httplib.BAD_REQUEST,
result.status_code result.status_code
) )
self.assertEqual( self.assertEqual(
'A server error occurred. Please contact the administrator.', 'Wrong path',
result.text result.text
) )
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment