mirror of
https://github.com/moritzruth/node-enttec-open-dmx-usb.git
synced 2025-04-21 07:41:22 +02:00
Forward SerialPort error event
This commit is contained in:
parent
0a2da2673e
commit
065d48d8fe
2 changed files with 8 additions and 1 deletions
|
@ -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.
|
||||
|
|
|
@ -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)
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Reference in a new issue