1
0
Fork 0
mirror of https://github.com/moritzruth/node-enttec-open-dmx-usb.git synced 2025-04-21 07:41:22 +02:00

Merge pull request #79 from Granjow/feature/fix-constructor-serial-error

This commit is contained in:
Moritz Ruth 2022-06-25 16:49:33 +02:00 committed by GitHub
commit a565e9e5b7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 1 deletions

View file

@ -41,4 +41,4 @@ import { EnttecOpenDMXUSBDevice as DMXDevice } from "enttec-open-dmx-usb";
## Events
`ready` - `startSending` can be called.
`error` - An error occurred.
`error` - An error occurred. The error can also originate from SerialPort.

View file

@ -35,6 +35,13 @@ export class EnttecOpenDMXUSBDevice extends EventEmitter<Events> {
this.emit("ready")
if (startSending) this.startSending(0)
})
// Forward SerialPort errors.
// If nothing is attaching to the SerialPort error event, the Node process will be terminated
// in case of an error (e.g. wrong device passed) which would not permit error handling in
// projects using this package.
this.port.on("error", (error: Error) => {
this.emit("error", error)
})
}
/**