[Groonga-commit] droonga/express-droonga at ec21454 [master] Report more errors for invalid command definitions

Back to archive index

YUKI Hiroshi null+****@clear*****
Thu Jan 9 12:15:26 JST 2014


YUKI Hiroshi	2014-01-09 12:15:26 +0900 (Thu, 09 Jan 2014)

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

  Message:
    Report more errors for invalid command definitions

  Modified files:
    lib/adapter/command.js

  Modified: lib/adapter/command.js (+8 -0)
===================================================================
--- lib/adapter/command.js    2014-01-09 12:13:25 +0900 (18fac20)
+++ lib/adapter/command.js    2014-01-09 12:15:26 +0900 (48f0668)
@@ -51,6 +51,8 @@ exports.RequestResponse = RequestResponse;
 
 function PublishSubscribe(options) {
   Command.apply(this, arguments);
+  if (typeof options.messageType != 'string')
+    throw new Error('You must specify "messageType" for a publish-subscribe command!');
 }
 PublishSubscribe.extend = function(targetClass) {
   Command.extend(targetClass);
@@ -120,6 +122,12 @@ exports.HTTPRequestResponse = HTTPRequestResponse;
 
 function HTTPStreaming(options) {
   Command.apply(this, arguments);
+  if (typeof options.subscription != 'string')
+    throw new Error('You must specify "subscription" for an HTTP streaming command!');
+  if (typeof options.unsubscription != 'string')
+    throw new Error('You must specify "unsubscription" for an HTTP streaming command!');
+  if (typeof options.messageType != 'string')
+    throw new Error('You must specify "messageType" for an HTTP streaming command!');
   if (typeof options.createSubscription != 'function')
     throw new Error('You must specify "createSubscription" for an HTTP streaming command!');
 }
-------------- next part --------------
HTML����������������������������...
Download 



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