Skip to content

Commit

Permalink
BREAKING CHANGE: selfId() might return undefined now
Browse files Browse the repository at this point in the history
  • Loading branch information
huan committed Mar 2, 2020
1 parent d8b300f commit 5c0f036
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/puppet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -386,12 +386,15 @@ export abstract class Puppet extends EventEmitter {
*/
public abstract async logout (): Promise<void>

public selfId (): string {
public selfId (): undefined | string {
log.verbose('Puppet', 'selfId()')

if (!this.id) {
throw new Error('not logged in, no this.id yet.')
}
/**
* Huan (202003): do not throw exception. deal `undefined` outside.
*/
// if (!this.id) {
// throw new Error('not logged in, no this.id yet.')
// }

return this.id
}
Expand Down

0 comments on commit 5c0f036

Please sign in to comment.