Skip to content

Commit

Permalink
Fix missing ERR_INVALID_ARG_TYPE in 2 buffer methods (#13617)
Browse files Browse the repository at this point in the history
  • Loading branch information
Jarred-Sumner authored Sep 1, 2024
1 parent ef4bcb3 commit f123814
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions src/bun.js/modules/NodeBufferModule.h
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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({});
}

Expand Down Expand Up @@ -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({});
}

Expand Down

0 comments on commit f123814

Please sign in to comment.