From a0e2c6d2843ea6e37035a949827cdcc7949026d6 Mon Sep 17 00:00:00 2001 From: Yaniv Friedensohn Date: Sat, 11 May 2019 20:00:38 +0300 Subject: src: add error codes to errors thrown in C++ PR-URL: https://github.com/nodejs/node/pull/27700 Reviewed-By: James M Snell Reviewed-By: Joyee Cheung Reviewed-By: Matteo Collina Reviewed-By: Rich Trott --- src/string_bytes.h | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-) (limited to 'src/string_bytes.h') diff --git a/src/string_bytes.h b/src/string_bytes.h index 62a6724737..6ffdc47db7 100644 --- a/src/string_bytes.h +++ b/src/string_bytes.h @@ -37,14 +37,7 @@ class StringBytes { public: inline v8::Maybe Decode(Environment* env, v8::Local string, - v8::Local encoding, - enum encoding _default) { - enum encoding enc = ParseEncoding(env->isolate(), encoding, _default); - if (!StringBytes::IsValidString(string, enc)) { - env->ThrowTypeError("Bad input string"); - return v8::Nothing(); - } - + enum encoding enc) { size_t storage; if (!StringBytes::StorageSize(env->isolate(), string, enc).To(&storage)) return v8::Nothing(); @@ -60,12 +53,6 @@ class StringBytes { inline size_t size() const { return length(); } }; - // Does the string match the encoding? Quick but non-exhaustive. - // Example: a HEX string must have a length that's a multiple of two. - // FIXME(bnoordhuis) IsMaybeValidString()? Naming things is hard... - static bool IsValidString(v8::Local string, - enum encoding enc); - // Fast, but can be 2 bytes oversized for Base64, and // as much as triple UTF-8 strings <= 65536 chars in length static v8::Maybe StorageSize(v8::Isolate* isolate, -- cgit v1.2.3