From 177498bd2080f1784154d57382d21ff53b264c73 Mon Sep 17 00:00:00 2001 From: cTn Date: Mon, 22 Sep 2014 21:16:52 +0200 Subject: [PATCH] catch some runtime errors in current context --- js/backup_restore.js | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/js/backup_restore.js b/js/backup_restore.js index 73f3f472..9423e4de 100644 --- a/js/backup_restore.js +++ b/js/backup_restore.js @@ -48,9 +48,13 @@ function configuration_backup() { // create or load the file chrome.fileSystem.chooseEntry({type: 'saveFile', suggestedName: 'baseflight_backup_' + now, accepts: accepts}, function (fileEntry) { + if (chrome.runtime.lastError) { + console.error(chrome.runtime.lastError.message); + return; + } + if (!fileEntry) { console.log('No file selected, backup aborted.'); - return; } @@ -127,9 +131,13 @@ function configuration_restore() { // load up the file chrome.fileSystem.chooseEntry({type: 'openFile', accepts: accepts}, function (fileEntry) { + if (chrome.runtime.lastError) { + console.error(chrome.runtime.lastError.message); + return; + } + if (!fileEntry) { console.log('No file selected, restore aborted.'); - return; }