[Groonga-commit] groonga/gcs [master] Report domain validatiion error correctly

Back to archive index

YUKI Hiroshi null+****@clear*****
Mon Nov 26 19:25:31 JST 2012


YUKI Hiroshi	2012-11-26 19:25:31 +0900 (Mon, 26 Nov 2012)

  New Revision: b9edfb7c8939415b42709c5a2da93d388f917563
  https://github.com/groonga/gcs/commit/b9edfb7c8939415b42709c5a2da93d388f917563

  Log:
    Report domain validatiion error correctly

  Modified files:
    lib/api/2011-02-01/configuration.js

  Modified: lib/api/2011-02-01/configuration.js (+6 -2)
===================================================================
--- lib/api/2011-02-01/configuration.js    2012-11-26 19:23:20 +0900 (c701858)
+++ lib/api/2011-02-01/configuration.js    2012-11-26 19:25:31 +0900 (1377106)
@@ -326,12 +326,14 @@ handlers.DefineIndexField = function(context, request, response, config) {
 
   var domainName = request.query.DomainName || '';
   var domain;
+  var domainValidationError;
   try {
     handleDomanValidationError(function() {
       domain = new Domain(domainName, context);
       domain.validate();
     });
   } catch(error) {
+    domainValidationError = error;
     if (error.isValidationError && error.isMultiplexed)
       validationErrors = validationErrors.concat(error.messages);
     else
@@ -339,7 +341,7 @@ handlers.DefineIndexField = function(context, request, response, config) {
   }
 
   function assertNoOtherError() {
-    if (!domain || !domain.exists())
+    if (!domainValidationError && (!domain || !domain.exists()))
       throw new errors.ResourceNotFoundError('Domain not found: ' + domainName);
 
     if (validationErrors.length)
@@ -406,12 +408,14 @@ handlers.DeleteIndexField = function(context, request, response, config) {
 
   var domainName = request.query.DomainName || '';
   var domain;
+  var domainValidationError;
   try {
     handleDomanValidationError(function() {
       domain = new Domain(domainName, context);
       domain.validate();
     });
   } catch(error) {
+    domainValidationError = error;
     if (error.isValidationError && error.isMultiplexed)
       validationErrors = validationErrors.concat(error.messages);
     else
@@ -419,7 +423,7 @@ handlers.DeleteIndexField = function(context, request, response, config) {
   }
 
   function assertNoOtherError() {
-    if (!domain || !domain.exists())
+    if (!domainValidationError && (!domain || !domain.exists()))
       throw new errors.ResourceNotFoundError('Domain not found: ' + domainName);
 
     if (validationErrors.length)
-------------- next part --------------
HTML����������������������������...
Télécharger 



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