From 2ff107dad7faaef617916d84101bb43b73dbd4e6 Mon Sep 17 00:00:00 2001 From: Lovell Fuller Date: Thu, 30 Mar 2017 13:21:49 +0100 Subject: [PATCH] test: add case for url.parse throwing a URIError The auth property of a URL is decoded via decodeURIComponent, which can throw a URIError. The test URL here will trigger this. Adds documentation on the possible errors url.parse can throw. PR-URL: https://github.com/nodejs/node/pull/12135 Reviewed-By: Colin Ihrig Reviewed-By: Joyee Cheung Reviewed-By: James M Snell --- doc/api/url.md | 4 ++++ test/parallel/test-url-parse-invalid-input.js | 2 ++ 2 files changed, 6 insertions(+) diff --git a/doc/api/url.md b/doc/api/url.md index 7efd85c51308a3..54c6fbdaf21068 100644 --- a/doc/api/url.md +++ b/doc/api/url.md @@ -259,6 +259,10 @@ added: v0.1.25 The `url.parse()` method takes a URL string, parses it, and returns a URL object. +A `TypeError` is thrown if `urlString` is not a string. + +A `URIError` is thrown if the `auth` property is present but cannot be decoded. + ## url.resolve(from, to)