Closed gfablima closed 3 years ago
Is this used for some internal error handling features?
Confirmed incorrect behavior.
>eshost --tags jsvu -is E:\work\bugs\rs5bugs\_curiosity\issue5443\test.js
## Source
try{
throw new Error(null)
}catch (e){
print(e.message)
}
try{
throw new Error('a')
}catch (e){
print(e.message)
}
try{
throw new Error(null, 'test failed', 'another argument')
}catch (e){
print(e.message)
}
try{
throw new Error('b', 'test failed', 'another argument')
}catch (e){
print(e.message)
}
#### jsvu-ch
null
a
test failed
test failed
#### jsvu-jsc, jsvu-sm, jsvu-v8, jsvu-xs
null
a
null
b
cinfuzz
Looking at this again my comment above may be unclear - what i saw by looking at the code is that ChakraCore intentionally implements a non-standard Error constructor it:
a) if called with 1 argument behaves per spec BUT b) if called with 2 arguments it assumes that argument 1 = error number/code and argument 2 = error message
This behaviour for 2 arguments is not per spec BUT looks very intentional hence my question above of it it's used for something specific (or more than one such thing) if so fixing it could break things.
Hi everyone,
I found an inconsistence on Error() with more than one argument. According to ES6 Error constructor the Error is called with only one argument (message). The other engines returns the first argument, chakra returns the second argument.
Steps to reproduce:
Actual results: Error: null Error: test failed
Expected results: Error: null Error: null
V8, SpiderMonkey and JSC works as expected.
OS: Ubuntu 16.04 x86 chakra: 1.11.0.0-beta