Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nodejs/node.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorBen Noordhuis <info@bnoordhuis.nl>2011-07-21 00:15:41 +0400
committerBen Noordhuis <info@bnoordhuis.nl>2011-07-21 02:51:48 +0400
commit1b0e054737b207977981e0fc818b013ba8bb0caa (patch)
tree502d3d5fb3e25e40e3e248d26e2336950c74d72c /lib
parent6f0740e67b785599cfd1112647249b5c678c7214 (diff)
url: throw descriptive error if url argument to parse() is not a string
Fixes #568.
Diffstat (limited to 'lib')
-rw-r--r--lib/url.js4
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/url.js b/lib/url.js
index e4fcf779fac..4f7611da960 100644
--- a/lib/url.js
+++ b/lib/url.js
@@ -88,6 +88,10 @@ var protocolPattern = /^([a-z0-9]+:)/i,
function urlParse(url, parseQueryString, slashesDenoteHost) {
if (url && typeof(url) === 'object' && url.href) return url;
+ if (typeof url !== 'string') {
+ throw new TypeError("Parameter 'url' must be a string, not " + typeof url);
+ }
+
var out = {},
rest = url;