From 67166f7a9902c5d38f4f1f52f78591eeb2560932 Mon Sep 17 00:00:00 2001 From: Jordan Harband Date: Mon, 13 Jan 2020 21:50:38 -0800 Subject: [PATCH] [Fix] `parse`: throw a TypeError instead of an Error for bad charset (#349) --- lib/parse.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/parse.js b/lib/parse.js index d81628b5..22242351 100644 --- a/lib/parse.js +++ b/lib/parse.js @@ -196,7 +196,7 @@ var normalizeParseOptions = function normalizeParseOptions(opts) { } if (typeof opts.charset !== 'undefined' && opts.charset !== 'utf-8' && opts.charset !== 'iso-8859-1') { - throw new Error('The charset option must be either utf-8, iso-8859-1, or undefined'); + throw new TypeError('The charset option must be either utf-8, iso-8859-1, or undefined'); } var charset = typeof opts.charset === 'undefined' ? defaults.charset : opts.charset;