joyent/node — Issue #2532: Socket: Check type of object in "write" method
Author: Airs0urce
Created: 2012-01-14 00:54:14+00:00
State: open

Hey guys!
I spent time to determine what the problem I have, because in my case debug information says me almost nothing.
By mistake I forgot to stringify this object: {code: 142, data: "test"} before put it to write method:

var net = require('net');
var server = net.createServer(function(c) {
c.write({code: 142, data: "test"});
});
server.listen(9999);

As result I had this:

Assertion failed: (Buffer::HasInstance(args[0])), function Write, file ../src/stream_wrap.cc, line 289.
Abort trap: 6

So, may be we can check type of object we put to write method and throw exception in case if it's not applicable instead of this meaningless error (because there is even no backtrace)