From a89ded61b090c60455149e5d12acf57694d390fc Mon Sep 17 00:00:00 2001 From: liamcottle Date: Sun, 6 Oct 2024 16:50:03 +1300 Subject: [PATCH] ignore errors closing serial port --- index.html | 13 +++++++++++-- js/rnode.js | 6 +++++- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/index.html b/index.html index 4cda166..1b443e9 100644 --- a/index.html +++ b/index.html @@ -765,7 +765,12 @@ // close port console.log("Closing serial port"); - await this.serialPort.close(); + try { + await this.serialPort.close(); + } catch(e) { + console.log("failed to close serial port, ignoring...", e); + } + }, async flashEsp32() { @@ -884,7 +889,11 @@ // close port console.log("Closing serial port"); - await serialPort.close(); + try { + await serialPort.close(); + } catch(e) { + console.log("failed to close serial port, ignoring...", e); + } }, async detect() { diff --git a/js/rnode.js b/js/rnode.js index 3634b4b..875a225 100644 --- a/js/rnode.js +++ b/js/rnode.js @@ -135,7 +135,11 @@ class RNode { } async close() { - await this.serialPort.close(); + try { + await this.serialPort.close(); + } catch(e) { + console.log("failed to close serial port, ignoring...", e); + } } async write(bytes) {