[Groonga-commit] droonga/express-droonga at 5ed14fa [master] Report error for invalid command definitions

Back to archive index

YUKI Hiroshi null+****@clear*****
Thu Jan 9 12:13:25 JST 2014


YUKI Hiroshi	2014-01-09 12:13:25 +0900 (Thu, 09 Jan 2014)

  New Revision: 5ed14fad72489c452e6a65323423c99555265bed
  https://github.com/droonga/express-droonga/commit/5ed14fad72489c452e6a65323423c99555265bed

  Message:
    Report error for invalid command definitions

  Modified files:
    lib/adapter/command.js

  Modified: lib/adapter/command.js (+7 -0)
===================================================================
--- lib/adapter/command.js    2014-01-09 12:06:20 +0900 (b14c2b3)
+++ lib/adapter/command.js    2014-01-09 12:13:25 +0900 (18fac20)
@@ -83,6 +83,8 @@ exports.PublishSubscribe = PublishSubscribe;
 
 function HTTPCommand(options) {
   Command.apply(this, arguments);
+  if (typeof options.path != 'string')
+    throw new Error('You must specify "path" for an HTTP command!');
 }
 HTTPCommand.extend = function(targetClass) {
   Command.extend(targetClass);
@@ -118,6 +120,8 @@ exports.HTTPRequestResponse = HTTPRequestResponse;
 
 function HTTPStreaming(options) {
   Command.apply(this, arguments);
+  if (typeof options.createSubscription != 'function')
+    throw new Error('You must specify "createSubscription" for an HTTP streaming command!');
 }
 HTTPStreaming.extend = function(targetClass) {
   HTTPCommand.extend(targetClass);
@@ -134,11 +138,13 @@ HTTPStreaming.extend = function(targetClass) {
   Object.defineProperty(targetClass.prototype, 'messageType', {
     get: function() { return this._options.messageType; }
   });
+
   Object.defineProperty(targetClass.prototype, 'delimiter', {
     get: function() { return this._options.delimiter || targetClass.defaultDelimiter; }
   });
   if (!targetClass.defaultDelimiter)
     targetClass.defaultDelimiter = '\n';
+
   Object.defineProperty(targetClass.prototype, 'lifetime', {
     get: function() { return this._options.lifetime || targetClass.defaultLifetime; }
   });
@@ -148,6 +154,7 @@ HTTPStreaming.extend = function(targetClass) {
   Object.defineProperty(targetClass.prototype, 'createSubscription', {
     get: function() { return this._options.createSubscription; }
   });
+
   Object.defineProperty(targetClass.prototype, 'translate', {
     get: function() { return this._options.translate || this._translate; }
   });
-------------- next part --------------
HTML����������������������������...
下載 



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