Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handling client.logout() Exception gracefully with optional chaining #2447

Open
wants to merge 14 commits into
base: main
Choose a base branch
from
6 changes: 4 additions & 2 deletions src/Client.js
Original file line number Diff line number Diff line change
Expand Up @@ -802,7 +802,9 @@ class Client extends EventEmitter {
*/
async logout() {
await this.pupPage.evaluate(() => {
return window.Store.AppState.logout();
if (window.Store && window.Store.AppState && typeof window.Store.AppState.logout === 'function') {
ayushmourya marked this conversation as resolved.
Show resolved Hide resolved
return window.Store.AppState.logout();
}
});
await this.pupBrowser.close();

Expand Down Expand Up @@ -1717,4 +1719,4 @@ class Client extends EventEmitter {
}
}

module.exports = Client;
module.exports = Client;