Commit 16ac5dc7 by Konstantin Käfer

check for IsConstructCall

refs #29
parent 4c871191
......@@ -105,7 +105,7 @@ void Database::Schedule(EIO_Callback callback, Baton* baton, bool exclusive) {
Handle<Value> Database::New(const Arguments& args) {
HandleScope scope;
if (!Database::HasInstance(args.This())) {
if (!args.IsConstructCall()) {
return ThrowException(Exception::TypeError(
String::New("Use the new operator to create new Database objects"))
);
......
var sqlite3 = require('sqlite3');
var assert = require('assert');
exports['test Database() without new'] = function(beforeExit) {
assert.throws(function() {
sqlite3.Database(':memory:');
}, (/Use the new operator to create new Database objects/));
};
exports['test Database#get prepare fail'] = function(beforeExit) {
var db = new sqlite3.Database(':memory:');
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment