Dedicated error code for failed 3pid auth verification

This commit is contained in:
David Baker 2015-04-23 18:20:17 +01:00
parent 0eb61a3d16
commit 03eb4adc6e
2 changed files with 4 additions and 1 deletions

View file

@ -39,6 +39,7 @@ class Codes(object):
MISSING_PARAM = "M_MISSING_PARAM",
TOO_LARGE = "M_TOO_LARGE",
EXCLUSIVE = "M_EXCLUSIVE"
THREEPID_AUTH_FAILED = "M_THREEPID_AUTH_FAILED"
class CodeMessageException(RuntimeError):

View file

@ -126,7 +126,9 @@ class ThreepidRestServlet(RestServlet):
threepid = yield self.identity_handler.threepid_from_creds(threePidCreds)
if not threepid:
raise SynapseError(400, "Failed to auth 3pid")
raise SynapseError(
400, "Failed to auth 3pid", Codes.THREEPID_AUTH_FAILED
)
for reqd in ['medium', 'address', 'validatedAt']:
if reqd not in threepid: