summaryrefslogtreecommitdiff
path: root/src/string_bytes.cc
diff options
context:
space:
mode:
authorAnna Henningsen <anna@addaleax.net>2017-08-02 00:13:39 +0200
committerAnna Henningsen <anna@addaleax.net>2017-08-24 21:05:07 +0200
commit784c6d40f88c5a3b4270f2a6d4c7c120b4b12af6 (patch)
treecdf296c9ac7e655af395da2a44ddc8cc1228369d /src/string_bytes.cc
parent7e544240d34ca64d3817071ded3b705ba5f41cd0 (diff)
downloadandroid-node-v8-784c6d40f88c5a3b4270f2a6d4c7c120b4b12af6.tar.gz
android-node-v8-784c6d40f88c5a3b4270f2a6d4c7c120b4b12af6.tar.bz2
android-node-v8-784c6d40f88c5a3b4270f2a6d4c7c120b4b12af6.zip
src: use proper errors as coming from StringBytes
The previous errors were incorrect here, as the code only failed in situations where strings exceeded size limits or an OOM situation was encountered, not for invalid encodings (which aren’t even detected explicitly). Unfortunately, these situations are hard to test for. PR-URL: https://github.com/nodejs/node/pull/14579 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Diffstat (limited to 'src/string_bytes.cc')
-rw-r--r--src/string_bytes.cc2
1 files changed, 0 insertions, 2 deletions
diff --git a/src/string_bytes.cc b/src/string_bytes.cc
index 5aa3b8ca77..9df42f3bfa 100644
--- a/src/string_bytes.cc
+++ b/src/string_bytes.cc
@@ -686,7 +686,6 @@ MaybeLocal<Value> StringBytes::Encode(Isolate* isolate,
CHECK_NE(encoding, UCS2);
CHECK_BUFLEN_IN_RANGE(buflen);
- *error = Local<Value>();
if (!buflen && encoding != BUFFER) {
return String::Empty(isolate);
}
@@ -772,7 +771,6 @@ MaybeLocal<Value> StringBytes::Encode(Isolate* isolate,
size_t buflen,
Local<Value>* error) {
CHECK_BUFLEN_IN_RANGE(buflen);
- *error = Local<Value>();
// Node's "ucs2" encoding expects LE character data inside a
// Buffer, so we need to reorder on BE platforms. See