Permalink
Browse files

fixed merge conflict, got rid of sys

  • Loading branch information...
2 parents 4745db3 + 7c20db7 commit 9dcb7b44c0c04aa491c2ea1988dcf57670a8bf9a @substack committed May 1, 2012
Showing with 18 additions and 3 deletions.
  1. +4 −0 index.js
  2. +12 −2 test/error.js
  3. +2 −1 test/single.js
View
@@ -100,6 +100,10 @@ dnode.prototype.connect = function () {
}
function attachDnode() {
+ if (!stream) {
+ self.emit('error', new Error('Could not create a stream with this information ' + JSON.stringify(params)))
+ return null
+ }
client = createClient(self.proto, stream);
client.end = function () {
View
@@ -1,5 +1,4 @@
var dnode = require('../');
-var sys = require('sys');
var test = require('tap').test;
test('errors', function (t) {
@@ -99,4 +98,15 @@ test('close same server twice shouldn\'t throw errors', function(t) {
server.close();
});
server.listen(port);
-})
+});
+
+test('bad connection string', function(t) {
+ try {
+ var client = dnode.connect('garbage', function (remote, conn) {
+ assert.fail('should have been refused, very unlikely');
+ });
+ } catch (err) {
+ t.ok(/Could not create a stream/.test(err.message));
+ t.end();
+ }
+});
View
@@ -1,5 +1,6 @@
var dnode = require('../')
var test = require('tap').test;
+var util = require('util');
test('simple', function (t) {
t.plan(3);
@@ -11,7 +12,7 @@ test('simple', function (t) {
reply(n.number * 10);
},
print : function (n,reply) {
- reply(sys.inspect(n));
+ reply(util.inspect(n));
},
}).listen(port);

0 comments on commit 9dcb7b4

Please sign in to comment.