Skip to content

Commit 9780339

Browse files
committed
Fix sonar
1 parent d1a79fe commit 9780339

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

src/js/tabs/firmware_flasher.js

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -795,12 +795,10 @@ firmware_flasher.initialize = async function (callback) {
795795
tracking.sendEvent(tracking.EVENT_CATEGORIES.FLASHING, "DFU Flashing", {
796796
filename: self.filename || null,
797797
});
798-
try {
799-
DFU.connect(port, firmware, options);
800-
} catch (error) {
798+
DFU.connect(port, firmware, options).catch(error => {
801799
console.error(`${self.logHead} DFU connection failed:`, error);
802800
resetFlashingState();
803-
}
801+
});
804802
} else if (isSerial) {
805803
if ($("input.updating").is(":checked")) {
806804
options.no_reboot = true;
@@ -815,12 +813,10 @@ firmware_flasher.initialize = async function (callback) {
815813

816814
tracking.sendEvent(tracking.EVENT_CATEGORIES.FLASHING, "Flashing", { filename: self.filename || null });
817815

818-
try {
819-
STM32.connect(port, baud, firmware, options);
820-
} catch (error) {
816+
STM32.connect(port, baud, firmware, options).catch(error => {
821817
console.error(`${self.logHead} STM32 connection failed:`, error);
822818
resetFlashingState();
823-
}
819+
});
824820
} else {
825821
// Maybe the board is in DFU mode, but it does not have permissions. Ask for them.
826822
console.log(`${self.logHead} No valid port detected, asking for permissions`);

0 commit comments

Comments
 (0)