[Groonga-commit] droonga/express-droonga at 4b1372b [master] Report error when invalid record is loaded

Back to archive index

YUKI Hiroshi null+****@clear*****
Mon Jun 15 18:24:25 JST 2015


YUKI Hiroshi	2015-06-15 18:24:25 +0900 (Mon, 15 Jun 2015)

  New Revision: 4b1372b0312c4ad484631f5fb56cd928bd809db5
  https://github.com/droonga/express-droonga/commit/4b1372b0312c4ad484631f5fb56cd928bd809db5

  Message:
    Report error when invalid record is loaded

  Modified files:
    lib/adapter/api/groonga/loader.js

  Modified: lib/adapter/api/groonga/loader.js (+7 -1)
===================================================================
--- lib/adapter/api/groonga/loader.js    2015-06-15 18:19:03 +0900 (09ba8c6)
+++ lib/adapter/api/groonga/loader.js    2015-06-15 18:24:25 +0900 (81b0074)
@@ -93,7 +93,10 @@ Loader.prototype._onValue = function _onValue(value) {
         message.values[column] = value[i];
       }
     });
-  } else {
+  }
+  else if (value) {
+    if (typeof value != 'object')
+      throw new Error('invalid record: ' + JSON.stringify(value));
     Object.keys(value).forEach(function(key) {
       if (key == '_key') {
         message.key = value[key];
@@ -102,6 +105,9 @@ Loader.prototype._onValue = function _onValue(value) {
       }
     });
   }
+  else {
+    throw new Error('invalid record: ' + value);
+  }
 
   this._connection.emit('add', message, function(error, message) {
     this._nResponses++;
-------------- next part --------------
HTML����������������������������...
Download 



More information about the Groonga-commit mailing list
Back to archive index