Abandon fetching offline presence on 400 error

It seems like some servers return a M_UNRECOGNIZED code instead of
M_FORBIDDEN or "offline" when trying to fetch the presence for a user
and it's not available.

Fixes https://github.com/mirukana/mirage/issues/116
This commit is contained in:
miruka
2020-09-13 10:30:40 -04:00
parent a9c316fcf5
commit 32679aa7f8
2 changed files with 8 additions and 2 deletions

View File

@@ -33,6 +33,12 @@ class MatrixError(Exception):
return cls(response.transport_response.status, response.status_code)
@dataclass
class MatrixUnrecognized(MatrixError):
http_code: int = 400
m_code: str = "M_UNRECOGNIZED"
@dataclass
class MatrixInvalidAccessToken(MatrixError):
http_code: int = 401