mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-18 05:45:31 +03:00
catch lastError cleanly in current context
This commit is contained in:
parent
893671fa2b
commit
0bd4af89c9
1 changed files with 17 additions and 11 deletions
|
@ -30,7 +30,8 @@ var serial = {
|
||||||
switch (info.error) {
|
switch (info.error) {
|
||||||
case 'system_error': // we might be able to recover from this one
|
case 'system_error': // we might be able to recover from this one
|
||||||
var crunch_status = function (info) {
|
var crunch_status = function (info) {
|
||||||
if (info && !info.paused) {
|
if (info) {
|
||||||
|
if (!info.paused) {
|
||||||
console.log('SERIAL: Connection recovered from last onReceiveError');
|
console.log('SERIAL: Connection recovered from last onReceiveError');
|
||||||
googleAnalytics.sendException('Serial: onReceiveError - recovered', false);
|
googleAnalytics.sendException('Serial: onReceiveError - recovered', false);
|
||||||
} else {
|
} else {
|
||||||
|
@ -44,6 +45,11 @@ var serial = {
|
||||||
self.disconnect();
|
self.disconnect();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
if (chrome.runtime.lastError) {
|
||||||
|
console.error(chrome.runtime.lastError.message);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
chrome.serial.setPaused(self.connectionId, false, function () {
|
chrome.serial.setPaused(self.connectionId, false, function () {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue