Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve mismatched type handling. #44

Open
opnet opened this issue Feb 13, 2017 · 1 comment
Open

Improve mismatched type handling. #44

opnet opened this issue Feb 13, 2017 · 1 comment

Comments

@opnet
Copy link

opnet commented Feb 13, 2017

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.

@bnoordhuis
Copy link
Owner

A pull request would be welcome.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants