summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatt Watson <mattdangerw@gmail.com>2014-02-05 14:57:16 -0800
committerMatt Watson <mattdangerw@gmail.com>2014-02-05 14:57:16 -0800
commite0705284e07d21863adcf64cbb0462e527cf3060 (patch)
tree233e93c8ab43b4b9a6551450f49011ec63dfad5f
parent024886a49afbf4756440a7744548e482e118820b (diff)
Abort wiki app if json for personality not found
Prints our a warning message about an unsupported personality. Before we would just try to run anyway and segfault. This is a bit nicer [endlessm/eos-sdk#548]
-rw-r--r--wikipedia/presenters/domain_wiki_presenter.js14
1 files changed, 12 insertions, 2 deletions
diff --git a/wikipedia/presenters/domain_wiki_presenter.js b/wikipedia/presenters/domain_wiki_presenter.js
index 764bb17..736158d 100644
--- a/wikipedia/presenters/domain_wiki_presenter.js
+++ b/wikipedia/presenters/domain_wiki_presenter.js
@@ -1,6 +1,7 @@
const Endless = imports.gi.Endless;
const Lang = imports.lang;
const GObject = imports.gi.GObject;
+const System = imports.system;
//Local Libraries
const Utils = imports.wikipedia.utils;
@@ -67,8 +68,17 @@ const DomainWikiPresenter = new Lang.Class({
},
initAppInfoFromJsonFile: function(filename) {
- let app_content = JSON.parse(Utils.load_file_from_resource(filename));
- this._model.loadFromJson(app_content);
+ try {
+ let app_content = JSON.parse(Utils.load_file_from_resource(filename));
+ this._model.loadFromJson(app_content);
+ } catch(e) {
+ print(e);
+ if (e.matches(Gio.IOErrorEnum, Gio.IOErrorEnum.NOT_FOUND)) {
+ print("****** This app does not support the personality",
+ Endless.get_system_personality(), "******");
+ }
+ System.exit(1);
+ }
},
// Respond to the front page's 'category-clicked' signal by loading the