Added M_UNKNOWN_TOKEN error code and send it when there is an unrecognised access_token

This commit is contained in:
Kegan Dougal 2014-08-14 13:47:39 +01:00
parent d5033849a5
commit 61933f8e52
3 changed files with 8 additions and 3 deletions

View file

@ -18,7 +18,7 @@
from twisted.internet import defer
from synapse.api.constants import Membership
from synapse.api.errors import AuthError, StoreError
from synapse.api.errors import AuthError, StoreError, Codes
from synapse.api.events.room import (RoomTopicEvent, RoomMemberEvent,
MessageEvent, FeedbackEvent)
@ -163,4 +163,5 @@ class Auth(object):
user_id = yield self.store.get_user_by_token(token=token)
defer.returnValue(self.hs.parse_userid(user_id))
except StoreError:
raise AuthError(403, "Unrecognised access token.")
raise AuthError(403, "Unrecognised access token.",
errcode=Codes.UNKNOWN_TOKEN)