node-unix-dgram
node-unix-dgram copied to clipboard
Improve mismatched type handling.
When something other than an instance of Buffer
is sent to the send*
methods an assertion fails causing node to coredump. It seems more reasonable to throw TypeError
instead.
> const dgram = require('unix-dgram')
undefined
> const socket = dgram.createSocket('unix_dgram')
undefined
> socket.connect('/run/wpa_supplicant/wlan0')
undefined
> socket.send('ATTACH')
/usr/lib/electron/1.2.8/electron -i: ../src/unix_dgram.cc:304: Nan::NAN_METHOD_RETURN_TYPE {anonymous}::Send(Nan::NAN_METHOD_ARGS_TYPE): Assertion `node::Buffer::HasInstance(buf)' failed.
Aborted (core dumped)\
I can create a pull request for this as well if you guys want.
A pull request would be welcome.