diff options
author | Ben Noordhuis <info@bnoordhuis.nl> | 2011-07-21 00:15:41 +0400 |
---|---|---|
committer | Ben Noordhuis <info@bnoordhuis.nl> | 2011-07-21 02:51:48 +0400 |
commit | 1b0e054737b207977981e0fc818b013ba8bb0caa (patch) | |
tree | 502d3d5fb3e25e40e3e248d26e2336950c74d72c /lib | |
parent | 6f0740e67b785599cfd1112647249b5c678c7214 (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.js | 4 |
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; |