[gnome-maps] checkIn: Gracefully handle failure to create GOA client
- From: Marcus Lundblad <mlundblad src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-maps] checkIn: Gracefully handle failure to create GOA client
- Date: Thu, 16 Mar 2017 20:35:38 +0000 (UTC)
commit 9df6884ab55c3d6c005a4410f7f2a71b29270530
Author: Marcus Lundblad <ml update uu se>
Date: Tue Mar 14 22:10:41 2017 +0100
checkIn: Gracefully handle failure to create GOA client
Don't crash if we're not able to create the GOA client.
Instead gracefully disable check-in support.
https://bugzilla.gnome.org/show_bug.cgi?id=779975
src/checkIn.js | 20 ++++++++++++++++----
1 files changed, 16 insertions(+), 4 deletions(-)
---
diff --git a/src/checkIn.js b/src/checkIn.js
index 0830469..3291822 100644
--- a/src/checkIn.js
+++ b/src/checkIn.js
@@ -44,16 +44,26 @@ const CheckInManager = new Lang.Class({
_init: function() {
this.parent();
- this._goaClient = Goa.Client.new_sync(null);
+ try {
+ this._goaClient = Goa.Client.new_sync(null);
+ } catch (e) {
+ log('Error creating GOA client: %s'.format(e.message));
+ }
+
this._accounts = [];
this._authorizers = {};
this._backends = {};
this._initBackends();
- this._goaClient.connect('account-added', this._refreshGoaAccounts.bind(this));
- this._goaClient.connect('account-changed', this._refreshGoaAccounts.bind(this));
- this._goaClient.connect('account-removed', this._refreshGoaAccounts.bind(this));
+ if (this._goaClient) {
+ this._goaClient.connect('account-added',
+ this._refreshGoaAccounts.bind(this));
+ this._goaClient.connect('account-changed',
+ this._refreshGoaAccounts.bind(this));
+ this._goaClient.connect('account-removed',
+ this._refreshGoaAccounts.bind(this));
+ }
this._refreshGoaAccounts();
},
@@ -67,6 +77,8 @@ const CheckInManager = new Lang.Class({
},
_refreshGoaAccounts: function() {
+ if (!this._goaClient)
+ return;
let accounts = this._goaClient.get_accounts();
this._accounts = [];
this._accountsCount = 0;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]