mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-16 21:05:35 +03:00
catch some runtime errors in current context
This commit is contained in:
parent
2088a49b15
commit
177498bd20
1 changed files with 10 additions and 2 deletions
|
@ -48,9 +48,13 @@ function configuration_backup() {
|
||||||
|
|
||||||
// create or load the file
|
// create or load the file
|
||||||
chrome.fileSystem.chooseEntry({type: 'saveFile', suggestedName: 'baseflight_backup_' + now, accepts: accepts}, function (fileEntry) {
|
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) {
|
if (!fileEntry) {
|
||||||
console.log('No file selected, backup aborted.');
|
console.log('No file selected, backup aborted.');
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -127,9 +131,13 @@ function configuration_restore() {
|
||||||
|
|
||||||
// load up the file
|
// load up the file
|
||||||
chrome.fileSystem.chooseEntry({type: 'openFile', accepts: accepts}, function (fileEntry) {
|
chrome.fileSystem.chooseEntry({type: 'openFile', accepts: accepts}, function (fileEntry) {
|
||||||
|
if (chrome.runtime.lastError) {
|
||||||
|
console.error(chrome.runtime.lastError.message);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (!fileEntry) {
|
if (!fileEntry) {
|
||||||
console.log('No file selected, restore aborted.');
|
console.log('No file selected, restore aborted.');
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue