Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/socketry/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -854,7 +854,7 @@ async def _http_login(

if body.get("code") != 0:
msg = body.get("msg", "unknown error")
raise RuntimeError(f"Login failed: {msg}")
raise AuthenticationError(f"Login failed: {msg}")

data = body["data"]
token = body["token"]
Expand Down
2 changes: 1 addition & 1 deletion tests/test_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ async def test_login_no_devices(self):
async def test_login_failure_code(self):
with aioresponses() as m:
m.post(_LOGIN_URL, payload={"code": 1, "msg": "Bad credentials"})
with pytest.raises(RuntimeError, match="Login failed: Bad credentials"):
with pytest.raises(AuthenticationError, match="Login failed: Bad credentials"):
await _http_login("bad@example.com", "wrong")

async def test_login_http_error(self):
Expand Down