UNPKG

rpc-stream

Version:

very simple rpc. use with any thing that has .pipe()

22 lines (18 loc) 440 B
var rpc = require('../') var test = require('tape') test('error', function (t) { t.plan(3) var b = rpc() b.pipe(rpc({ hello: function (cb) { var err = new Error('oops'); err.foo = 'bar'; cb(err); } })).pipe(b) b.createRemoteCall('hello')(function (err) { t.ok(err instanceof Error, 'instanceof') t.equal(err.message, 'oops', 'message') t.equal(err.foo, 'bar', 'custom properties') }) })