Skip to content

Commit

Permalink
client.login: throw if the client is closed
Browse files Browse the repository at this point in the history
  • Loading branch information
eilvelia committed May 20, 2024
1 parent 6234ac5 commit e400912
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions packages/tdl/src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -544,6 +544,8 @@ export class Client {

login = (arg: LoginDetails | (() => LoginDetails) = {}): Promise<void> => {
return new Promise((resolve, reject) => {
if (this._client.val == null)
return reject(new Error('The client is closed'))
let loginDetails: StrictLoginDetails | null = null
function needLoginDetails (l: StrictLoginDetails | null): asserts l is StrictLoginDetails {
if (l == null && loginDetails == null) {
Expand Down

0 comments on commit e400912

Please sign in to comment.