mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-17 21:35:44 +03:00
use analytics exception API to handle/report serial related issues
This commit is contained in:
parent
1885fba5a0
commit
85bee11712
1 changed files with 5 additions and 5 deletions
10
js/serial.js
10
js/serial.js
|
@ -23,7 +23,7 @@ var serial = {
|
||||||
|
|
||||||
self.onReceiveError.addListener(function watch_for_on_receive_errors(info) {
|
self.onReceiveError.addListener(function watch_for_on_receive_errors(info) {
|
||||||
console.error(info);
|
console.error(info);
|
||||||
googleAnalytics.sendEvent('Error', 'Serial', info.error);
|
googleAnalytics.sendException('Serial: ' + info.error, false);
|
||||||
|
|
||||||
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
|
||||||
|
@ -36,11 +36,11 @@ var serial = {
|
||||||
function crunch_status(info) {
|
function crunch_status(info) {
|
||||||
if (!info.paused) {
|
if (!info.paused) {
|
||||||
console.log('SERIAL: Connection recovered from last onReceiveError');
|
console.log('SERIAL: Connection recovered from last onReceiveError');
|
||||||
googleAnalytics.sendEvent('Error', 'Serial', 'recovered');
|
googleAnalytics.sendException('Serial: onReceiveError - recovered', false);
|
||||||
} else {
|
} else {
|
||||||
console.log('SERIAL: Connection did not recover from last onReceiveError, disconnecting');
|
console.log('SERIAL: Connection did not recover from last onReceiveError, disconnecting');
|
||||||
GUI.log('Unrecoverable <span style="color: red">failure</span> of serial connection, disconnecting...');
|
GUI.log('Unrecoverable <span style="color: red">failure</span> of serial connection, disconnecting...');
|
||||||
googleAnalytics.sendEvent('Error', 'Serial', 'unrecoverable');
|
googleAnalytics.sendException('Serial: onReceiveError - unrecoverable', false);
|
||||||
|
|
||||||
if (GUI.connected_to || GUI.connecting_to) {
|
if (GUI.connected_to || GUI.connecting_to) {
|
||||||
$('a.connect').click();
|
$('a.connect').click();
|
||||||
|
@ -67,7 +67,7 @@ var serial = {
|
||||||
if (callback) callback(connectionInfo);
|
if (callback) callback(connectionInfo);
|
||||||
} else {
|
} else {
|
||||||
console.log('SERIAL: Failed to open serial port');
|
console.log('SERIAL: Failed to open serial port');
|
||||||
googleAnalytics.sendEvent('Error', 'Serial', 'FailedToOpen');
|
googleAnalytics.sendException('Serial: FailedToOpen', false);
|
||||||
if (callback) callback(false);
|
if (callback) callback(false);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -91,7 +91,7 @@ var serial = {
|
||||||
console.log('SERIAL: Connection with ID: ' + self.connectionId + ' closed');
|
console.log('SERIAL: Connection with ID: ' + self.connectionId + ' closed');
|
||||||
} else {
|
} else {
|
||||||
console.log('SERIAL: Failed to close connection with ID: ' + self.connectionId + ' closed');
|
console.log('SERIAL: Failed to close connection with ID: ' + self.connectionId + ' closed');
|
||||||
googleAnalytics.sendEvent('Error', 'Serial', 'FailedToClose');
|
googleAnalytics.sendException('Serial: FailedToClose', false);
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log('SERIAL: Statistics - Sent: ' + self.bytes_sent + ' bytes, Received: ' + self.bytes_received + ' bytes');
|
console.log('SERIAL: Statistics - Sent: ' + self.bytes_sent + ' bytes, Received: ' + self.bytes_received + ' bytes');
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue