Do not return identical error messages twice

e.g.

 $> curl -d '{"passwordCredentials": ...}' -H "Content-type: application/json" http://localhost:5000/v2.0/tokens

should return:

 {"badRequest": {"message": "Expecting auth", "code": "400"}}

not:

 {"badRequest": {"message": "Expecting auth or Expecting auth", "code": "400"}}

Change-Id: I76a432cbb4c964f4050b8596c773e0a553120ca3
This commit is contained in:
Mark McLoughlin 2011-09-30 12:06:24 +01:00
parent 8948d10db4
commit e7c4c4b028
1 changed files with 4 additions and 1 deletions

View File

@ -24,7 +24,10 @@ class AuthController(wsgi.Controller):
result = config.SERVICE.authenticate_with_unscoped_token(
unscoped)
except fault.BadRequestFault as e2:
raise fault.BadRequestFault(e1.msg + ' or ' + e2.msg)
if e1.msg == e2.msg:
raise e1
else:
raise fault.BadRequestFault(e1.msg + ' or ' + e2.msg)
return utils.send_result(200, req, result)