From f123814d8752dbc19c33776c567224c2890fd432 Mon Sep 17 00:00:00 2001 From: Jarred Sumner Date: Sun, 1 Sep 2024 04:40:14 -0700 Subject: [PATCH] Fix missing `ERR_INVALID_ARG_TYPE` in 2 buffer methods (#13617) --- src/bun.js/modules/NodeBufferModule.h | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/src/bun.js/modules/NodeBufferModule.h b/src/bun.js/modules/NodeBufferModule.h index d44b981967fd52..b35dec34708b9d 100644 --- a/src/bun.js/modules/NodeBufferModule.h +++ b/src/bun.js/modules/NodeBufferModule.h @@ -3,6 +3,7 @@ #include "root.h" #include "../bindings/JSBuffer.h" +#include "ErrorCode.h" #include "JavaScriptCore/PageCount.h" #include "_NativeModule.h" #include "wtf/SIMDUTF.h" @@ -58,10 +59,9 @@ JSC_DEFINE_HOST_FUNCTION(jsBufferConstructorFunction_isUtf8, ptr = reinterpret_cast(impl->data()); } else { - throwVMError( - lexicalGlobalObject, throwScope, - createTypeError(lexicalGlobalObject, - "First argument must be an ArrayBufferView"_s)); + Bun::throwError(lexicalGlobalObject, throwScope, + Bun::ErrorCode::ERR_INVALID_ARG_TYPE, + "First argument must be an ArrayBufferView"_s); return JSValue::encode({}); } @@ -115,10 +115,9 @@ JSC_DEFINE_HOST_FUNCTION(jsBufferConstructorFunction_isAscii, ptr = reinterpret_cast(impl->data()); } else { - throwVMError( - lexicalGlobalObject, throwScope, - createTypeError(lexicalGlobalObject, - "First argument must be an ArrayBufferView"_s)); + Bun::throwError(lexicalGlobalObject, throwScope, + Bun::ErrorCode::ERR_INVALID_ARG_TYPE, + "First argument must be an ArrayBufferView"_s); return JSValue::encode({}); }