Operator: errors
Handle error signal in the stream. By default, the error signal is blocked from propagating in the stream.
Signature
NS.errors(comment : string, inputs : map, outputs : map, errorHandler : function) : Node
Arguments
Arguement | Type | Description |
---|---|---|
comment | string | optional, the comment of the errors handler node |
inputs | map | optional, the input description |
outputs | map | optional, the output description |
errorHandler | function | the error handler function |
Return
Type | Description |
---|---|
Node | the errors node |
The signature of error handler function
function errorHandler(signal : Signal, rethrow : function) : void
Pass a errorHandler function as parameter to handle the error signal. The error could be obtained from signal’s error field. By default, the signal is blocked by the error handler, you can keep propagating the error signal by rethrow it using rethrow
method.
Create a sensor
const errorHandler = collar.errors((signal, rethrow) => {
console.error(signal.error);
rethrow(signal);
});