diff --git a/Userland/Libraries/LibJS/Runtime/BigInt.cpp b/Userland/Libraries/LibJS/Runtime/BigInt.cpp index 60022cccef..ec6db73e49 100644 --- a/Userland/Libraries/LibJS/Runtime/BigInt.cpp +++ b/Userland/Libraries/LibJS/Runtime/BigInt.cpp @@ -34,7 +34,7 @@ BigInt* number_to_bigint(GlobalObject& global_object, Value number) // 1. If IsIntegralNumber(number) is false, throw a RangeError exception. if (!number.is_integral_number()) { - vm.throw_exception(global_object, ErrorType::BigIntIntArgument); + vm.throw_exception(global_object, ErrorType::BigIntFromNonIntegral); return {}; } diff --git a/Userland/Libraries/LibJS/Runtime/ErrorTypes.h b/Userland/Libraries/LibJS/Runtime/ErrorTypes.h index 57900f990a..56378ab499 100644 --- a/Userland/Libraries/LibJS/Runtime/ErrorTypes.h +++ b/Userland/Libraries/LibJS/Runtime/ErrorTypes.h @@ -12,7 +12,7 @@ M(AccessorValueOrWritable, "Accessor property descriptor cannot specify a value or writable key") \ M(BigIntBadOperator, "Cannot use {} operator with BigInt") \ M(BigIntBadOperatorOtherType, "Cannot use {} operator with BigInt and other type") \ - M(BigIntIntArgument, "BigInt argument must be an integer") \ + M(BigIntFromNonIntegral, "Cannot convert non-integral number to BigInt") \ M(BigIntInvalidValue, "Invalid value for BigInt: {}") \ M(BindingNotInitialized, "Binding {} is not initialized") \ M(ClassConstructorWithoutNew, "Class constructor {} must be called with 'new'") \ diff --git a/Userland/Libraries/LibJS/Tests/builtins/BigInt/BigInt.js b/Userland/Libraries/LibJS/Tests/builtins/BigInt/BigInt.js index 7e517754b7..61b5a29a84 100644 --- a/Userland/Libraries/LibJS/Tests/builtins/BigInt/BigInt.js +++ b/Userland/Libraries/LibJS/Tests/builtins/BigInt/BigInt.js @@ -62,7 +62,7 @@ describe("errors", () => { [1.23, Infinity, -Infinity, NaN].forEach(value => { expect(() => { BigInt(value); - }).toThrowWithMessage(RangeError, "BigInt argument must be an integer"); + }).toThrowWithMessage(RangeError, "Cannot convert non-integral number to BigInt"); }); }); });