Skip to content

Commit

Permalink
Added/improved logging [minor]
Browse files Browse the repository at this point in the history
  • Loading branch information
Chris White committed Aug 6, 2018
1 parent bc14343 commit 780e4d8
Showing 1 changed file with 15 additions and 6 deletions.
21 changes: 15 additions & 6 deletions tabfern/src/view/tree.js
Original file line number Diff line number Diff line change
Expand Up @@ -2414,9 +2414,11 @@ function hamRestoreFromBackup()
let parsed = JSON.parse(text);
ok = loadSavedWindowsFromData(parsed);
if(!ok) {
log.warn({'Could not load file':e});
window.alert("I couldn't load the file " + filename);
}
} catch(e) {
log.warn({'Could not load file (exception thrown)':e});
window.alert("File " + filename + ' is not something I can '+
'understand as a TabFern save file. Parse error code was: ' +
e);
Expand All @@ -2430,8 +2432,14 @@ function hamRestoreFromBackup()
}
} //processFile()

let importer = new Modules.importer(document, '.tabfern');
importer.getFileAsString(processFile);
try {
let importer = new Modules.importer(document, '.tabfern');
importer.getFileAsString(processFile);
} catch(e) {
log.warn({'Could not run importer':e});
window.alert('Unexpected error while trying to load the file. ' +
'Parse error code was: ' + e);
}
} //hamRestoreFromBackup()

function hamRestoreLastDeleted()
Expand Down Expand Up @@ -3713,9 +3721,10 @@ function moveWinToLastPositionIfAny_catch(done, items_or_err)

$(K.INIT_PROGRESS_SEL).text("11/13");
if(ASQH.is_asq_try_err(items_or_err)) {
log.warn({"Couldn't get saved location":items_or_err});
log.warn({"Couldn't get saved location":$.extend({},items_or_err)});
// Note: $.extend() used to force evaluation at the time of logging
} else { //we have a location
log.info({"Got saved location":items_or_err});
log.info({"Got saved location":$.extend({},items_or_err)});

let parsed = items_or_err[K.LOCN_KEY];
if( (parsed !== null) && (typeof parsed === 'object') ) {
Expand All @@ -3736,12 +3745,12 @@ function moveWinToLastPositionIfAny_catch(done, items_or_err)
if(isLastError()) {
log.error(`Could not open window: ${chrome.runtime.lastError}`);
} else {
log.info({"Updated window size":win});
log.info({"Updated window size":$.extend({},win)});
}
}
);
} else {
log.warn({"Could not parse size from":items_or_err})
log.warn({"Could not parse size from":$.extend({},items_or_err)})
} //endif got an item else

} //endif storage.local.get worked
Expand Down

0 comments on commit 780e4d8

Please sign in to comment.