LibJS: Tweak error message in the NumberToBigInt abstract operation
This is no longer specific to the BigInt() constructor, so it shouldn't be mentioning an 'argument' that we might not have.
This commit is contained in:
parent
9f2dd89446
commit
3014e529be
Notes:
sideshowbarker
2024-07-18 10:00:48 +09:00
Author: https://github.com/linusg Commit: https://github.com/SerenityOS/serenity/commit/3014e529be3 Pull-request: https://github.com/SerenityOS/serenity/pull/8580
3 changed files with 3 additions and 3 deletions
Userland/Libraries/LibJS
|
@ -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<RangeError>(global_object, ErrorType::BigIntIntArgument);
|
||||
vm.throw_exception<RangeError>(global_object, ErrorType::BigIntFromNonIntegral);
|
||||
return {};
|
||||
}
|
||||
|
||||
|
|
|
@ -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'") \
|
||||
|
|
|
@ -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");
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Add table
Reference in a new issue