Make get_domain_from_id throw SynapseError on invalid ID

This commit is contained in:
Erik Johnston 2016-06-14 13:25:29 +01:00
parent 16a8884233
commit 36e2aade87

View file

@ -22,7 +22,10 @@ Requester = namedtuple("Requester", ["user", "access_token_id", "is_guest"])
def get_domain_from_id(string):
return string.split(":", 1)[1]
try:
return string.split(":", 1)[1]
except IndexError:
raise SynapseError(400, "Invalid ID: %r", string)
class DomainSpecificString(