Skip to content

Improve exception thrown when calling a invalid constructor #991

Open
@harumazzz

Description

@harumazzz

On this simple js code:

const objLiteral = {};  
const instance = new objLiteral();

In engine v8, the error will be: TypeError: objLiteral is not a constructor

However, in quickjs-ng: not a constructor

Test 2:

const num = 42;
const instance = new num();

Test 3:

const test_func = () => {};
const instance = new test_func(); 

In all of these cases quickjs-ng throw the exception "not a constructor", while in engine v8 the error is more clear like num is not a constructor or test_func is not a constructor. Can this be improved?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions