null+****@clear*****
null+****@clear*****
2011年 11月 24日 (木) 16:15:22 JST
Yoji SHIDARA 2011-11-24 07:15:22 +0000 (Thu, 24 Nov 2011)
New Revision: 4530c1511986a10594a9b6c2d379d590bbedff89
Log:
check if db is opened successfully
Modified files:
src/nroonga.cc
Modified: src/nroonga.cc (+3 -0)
===================================================================
--- src/nroonga.cc 2011-11-22 08:14:43 +0000 (f718c7c)
+++ src/nroonga.cc 2011-11-24 07:15:22 +0000 (4595be1)
@@ -41,6 +41,9 @@ Handle<Value> Database::New(const Arguments& args) {
} else if(args[0]->IsString()) {
String::Utf8Value path(args[0]->ToString());
GRN_DB_OPEN_OR_CREATE(ctx, *path, NULL, db->database);
+ if (!db->database) {
+ return ThrowException(Exception::Error(String::New("DB open failed")));
+ }
} else {
return ThrowException(Exception::TypeError(String::New("Bad parameter")));
}