src: rework (mostly internal) functions to use Maybes

Rework all affected functions to use Maybes, thus improving error
handling substantially in internal functions, API functions as well as
utilities.

Co-authored-by: Michaël Zasso <targos@protonmail.com>
PR-URL: https://github.com/nodejs/node/pull/21935
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
This commit is contained in:
Ujjwal SharmaandMichaël Zasso authored and Anna Henningsen committed 2018-09-02 14:25:16 +02:00
1 parent 67403b3a84
commit a55c57b8c4
10 files changed
+149 -117

No files matched your search

+1 -1
View File
@@ -121,7 +121,7 @@ ssize_t DecodeBytes(Isolate* isolate,
enum encoding encoding) {
HandleScope scope(isolate);
return StringBytes::Size(isolate, val, encoding);
return StringBytes::Size(isolate, val, encoding).FromMaybe(-1);
}
// Returns number of bytes written.