Skip to content

Commit 1c21f64

Browse files
committed
Make invalid token type raise TypeError
1 parent 16dcf2c commit 1c21f64

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

discord/client.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -460,13 +460,17 @@ async def login(self, token: str) -> None:
460460
461461
Raises
462462
------
463+
TypeError
464+
The token was in invalid type.
463465
:exc:`.LoginFailure`
464466
The wrong credentials are passed.
465467
:exc:`.HTTPException`
466468
An unknown HTTP related error occurred,
467469
usually when it isn't 200 or the known incorrect credentials
468470
passing status code.
469471
"""
472+
if not isinstance(token, str):
473+
raise TypeError(f"token must be of type str, not {token.__class__.__name__}")
470474

471475
_log.info('logging in using static token')
472476

0 commit comments

Comments
 (0)