[polari/wip/bastianilso/error-handling: 15/19] app: Don't treat network unavailability as app error
- From: Bastian Ilsø Hougaard <bastianilso src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [polari/wip/bastianilso/error-handling: 15/19] app: Don't treat network unavailability as app error
- Date: Thu, 13 Aug 2015 17:18:53 +0000 (UTC)
commit d9a4c382c62162aef79571242400466133405520
Author: Bastian Ilsø <bastianilso src gnome org>
Date: Sun Aug 2 17:50:29 2015 +0200
app: Don't treat network unavailability as app error
If we receive a disconnect error and the network is
unavailable, then the error is not specific to Polari.
src/application.js | 6 ++++++
1 files changed, 6 insertions(+), 0 deletions(-)
---
diff --git a/src/application.js b/src/application.js
index 7262bfd..be96bf4 100644
--- a/src/application.js
+++ b/src/application.js
@@ -307,6 +307,12 @@ const Application = new Lang.Class({
this._addSavedChannel(account, requestData.targetId);
} catch (e if e.matches(Tp.Error, Tp.Error.DISCONNECTED)) {
let error = account.connection_error;
+ // If we receive a disconnect error and the network is unavailable,
+ // then the error is not specific to polari and polari will
+ // just be in offline state.
+ let networkMonitor = Gio.NetworkMonitor.get_default();
+ if (!networkMonitor.network_available)
+ return;
if (error == ConnectionError.ALREADY_CONNECTED &&
requestData.retry++ < MAX_RETRIES) {
this._retryRequest(requestData);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]