Fix missing ERR_INVALID_ARG_TYPE in 2 buffer methods (#13617)

This commit is contained in:
Jarred Sumner
2024-09-01 04:40:14 -07:00
committed by GitHub
parent ef4bcb314c
commit f123814d87

View File

@@ -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<const char *>(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<const char *>(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({});
}