diff --git a/lib/net.js b/lib/net.js index ed80d02f32..7767b00086 100644 --- a/lib/net.js +++ b/lib/net.js @@ -38,6 +38,7 @@ var WriteWrap = process.binding('stream_wrap').WriteWrap; var cluster; var errnoException = util._errnoException; +var detailedException = util._detailedException; function noop() {} @@ -68,26 +69,6 @@ function isPipeName(s) { return util.isString(s) && toNumber(s) === false; } -// format exceptions -function detailedException(err, syscall, address, port, additional) { - var details; - if (port && port > 0) { - details = address + ':' + port; - } else { - details = address; - } - - if (additional) { - details += ' - Local (' + additional + ')'; - } - var ex = errnoException(err, syscall, details); - ex.address = address; - if (port) { - ex.port = port; - } - return ex; -} - exports.createServer = function() { return new Server(arguments[0], arguments[1]); }; diff --git a/lib/util.js b/lib/util.js index c022f6f7e2..5f3e59cc64 100644 --- a/lib/util.js +++ b/lib/util.js @@ -756,3 +756,23 @@ exports._errnoException = function(err, syscall, original) { e.syscall = syscall; return e; }; + + +exports._detailedException = function(err, syscall, address, port, additional) { + var details; + if (port && port > 0) { + details = address + ':' + port; + } else { + details = address; + } + + if (additional) { + details += ' - Local (' + additional + ')'; + } + var ex = exports._errnoException(err, syscall, details); + ex.address = address; + if (port) { + ex.port = port; + } + return ex; +};