@@ -912,8 +912,9 @@ Socket.prototype.connect = function(options, cb) {
|
912 | 912 | this._sockname = null; |
913 | 913 | } |
914 | 914 | |
915 | | -var pipe = !!options.path; |
916 | | -debug('pipe', pipe, options.path); |
| 915 | +const path = options.path; |
| 916 | +var pipe = !!path; |
| 917 | +debug('pipe', pipe, path); |
917 | 918 | |
918 | 919 | if (!this._handle) { |
919 | 920 | this._handle = pipe ? new Pipe() : new TCP(); |
@@ -930,7 +931,10 @@ Socket.prototype.connect = function(options, cb) {
|
930 | 931 | this.writable = true; |
931 | 932 | |
932 | 933 | if (pipe) { |
933 | | -connect(this, options.path); |
| 934 | +if (typeof path !== 'string') { |
| 935 | +throw new TypeError('"path" option must be a string: ' + path); |
| 936 | +} |
| 937 | +connect(this, path); |
934 | 938 | } else { |
935 | 939 | lookupAndConnect(this, options); |
936 | 940 | } |
|