Skip to content

[Bug]: Serial transport uncaught exception when suddenly disconnected #957

@danpeig

Description

@danpeig

Before submitting

  • I have searched existing issues to make sure this bug hasn't already been reported
  • I have updated to the latest version of the software to verify the issue still exists
  • I have cleared cache/cookies/storage or tried in a private/incognito window (if applicable)

Hardware

Not Applicable

Connection Type

Serial

Local or Hosted

http://meshtastic.local

Firmware Version

2.6.11

Operating System

Linux

Browser

Node

Expected Behavior

The library should be able to handle the exception without crashing the script.

Actual Behavior

When the device is physically disconnected after the connection was established, it throws and exception and the whole script crashes.

Steps to Reproduce

  1. Connect to any serial device.
  2. Disconnect the cable.
  3. See what happens.

Relevant console output

Uncaught Exception:
14 Nov 12:02:17 - [error] AbortError: The operation was aborted
    at SerialPort.<anonymous> (node:internal/webstreams/adapters:442:19)
    at SerialPort.<anonymous> (node:internal/util:524:20)
    at SerialPort.onclose (node:internal/streams/end-of-stream:153:25)
    at SerialPort.emit (node:events:536:35)
    at SerialPort.emit (node:domain:489:12)
    at port.close.then.closing (/home/galacticus/Downloads/test/node_modules/@serialport/stream/dist/index.js:242:18)

Screenshots

No response

Additional Context

I already submitted a PR for another crash that would happen if the serial port was not available during the connection. This one I was unable to fix.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions