We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 1331990 commit bd94320Copy full SHA for bd94320
06_objects/modulename.cpp
@@ -34,6 +34,12 @@ MyObject::MyObject(int val)
34
Handle<Value> MyObject::New(const Arguments& args) {
35
HandleScope scope;
36
37
+ if (!args.IsConstructCall()) {
38
+ return ThrowException(Exception::TypeError(
39
+ String::New("Use the new operator to create instances of this object."))
40
+ );
41
+ }
42
+
43
if (args.Length() < 1) {
44
return ThrowException(Exception::TypeError(
45
String::New("First argument must be a number")));
0 commit comments