diff --git a/src/node_buffer.cc b/src/node_buffer.cc index 76a733311b0eb0..c8be5b5a448c9e 100644 --- a/src/node_buffer.cc +++ b/src/node_buffer.cc @@ -408,8 +408,10 @@ void Create(const FunctionCallbackInfo& args) { void* data; if (length > 0) { data = malloc(length); - if (data == nullptr) - return env->ThrowRangeError("invalid Buffer length"); + if (data == nullptr) { + return env->ThrowRangeError( + "Buffer allocation failed - process out of memory"); + } } else { data = nullptr; }