[Groonga-commit] droonga/express-droonga at 24dbbcf [master] Raise errors for invalid rules

Back to archive index

YUKI Hiroshi null+****@clear*****
Thu Mar 20 16:22:55 JST 2014


YUKI Hiroshi	2014-03-20 16:22:55 +0900 (Thu, 20 Mar 2014)

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

  Message:
    Raise errors for invalid rules

  Modified files:
    lib/response-cache/cache.js

  Modified: lib/response-cache/cache.js (+6 -1)
===================================================================
--- lib/response-cache/cache.js    2014-03-20 16:19:58 +0900 (cc204ba)
+++ lib/response-cache/cache.js    2014-03-20 16:22:55 +0900 (c45136e)
@@ -15,7 +15,12 @@ function normalizeTTLOption(options) {
 function normalizeCacheOptions(options) {
   options = options || {};
 
-  options.rules = options.rules || [];
+  if (!Array.isArray(options.rules))
+    throw new Error('rules must be an array');
+
+  if (!options.rules.length)
+    throw new Error('you must specify one or more rules');
+
   options.size = options.size || defaultSie;
   normalizeTTLOption(options);
 
-------------- next part --------------
HTML����������������������������...
Download 



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