node-udev icon indicating copy to clipboard operation
node-udev copied to clipboard

The event handler fails to print out exception messages

Open cheery opened this issue 8 years ago • 0 comments

In a related pull request, we may have spotted a bug. The bug causes the exceptions to be ignored silently inside the event handler.

To illustrate the problem, here's an example:

var util = require("util");
var udev = require("./udev.js");

var monitor = udev.monitor();
monitor.on('add', function (device) {
    console.log(device.DEVPATH + " added");
    throw new Error("Trycatch?");
});

The above example should result in an error logged, similar to the following program:

setTimeout(function(){
    console.log("timeout");
    throw new Error("Trycatch?");
}, 1);

There should be a handler in Node.js runtime that implements the behavior, it should be added into on_handle_event to resolve this issue.

cheery avatar Jun 09 '17 14:06 cheery