YUKI Hiroshi
null+****@clear*****
Mon Jun 15 18:44:18 JST 2015
YUKI Hiroshi 2015-06-15 18:44:18 +0900 (Mon, 15 Jun 2015) New Revision: 119aa6ae377424b1f4ec148959454f974b593eb6 https://github.com/droonga/express-droonga/commit/119aa6ae377424b1f4ec148959454f974b593eb6 Message: Return error response when there is any invalid record Modified files: lib/adapter/api/groonga/loader.js Modified: lib/adapter/api/groonga/loader.js (+13 -1) =================================================================== --- lib/adapter/api/groonga/loader.js 2015-06-15 18:24:25 +0900 (81b0074) +++ lib/adapter/api/groonga/loader.js 2015-06-15 18:44:18 +0900 (c51744b) @@ -37,10 +37,22 @@ Loader.prototype.run = function run() { this._isEnd = false; this._jsonParser.onValue = this._onValue.bind(this); + var aborted = false; this._request.on('data', function(chunk) { - this._jsonParser.write(chunk); + if (aborted) + return; + try { + this._jsonParser.write(chunk); + } catch(error) { + aborted = true; + this._statusCode = error.statusCode; + this._errorMessage = error.message; + this._sendResponse([0]); + } }.bind(this)); this._request.once('end', function() { + if (aborted) + return; this._isEnd = true; if (this._nRecords == 0) { -------------- next part -------------- HTML����������������������������...Download