[Groonga-commit] groonga/gcs [master] Raise ResourceNotFound error correctly

アーカイブの一覧に戻る

YUKI Hiroshi null+****@clear*****
Thu Nov 15 18:23:42 JST 2012


YUKI Hiroshi	2012-11-15 18:23:42 +0900 (Thu, 15 Nov 2012)

  New Revision: 604a3d5683f142ec8f37eed396dcbd72654f7148
  https://github.com/groonga/gcs/commit/604a3d5683f142ec8f37eed396dcbd72654f7148

  Log:
    Raise ResourceNotFound error correctly

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

  Modified: lib/api/2011-02-01/configuration.js (+6 -5)
===================================================================
--- lib/api/2011-02-01/configuration.js    2012-11-15 18:17:18 +0900 (ffea01e)
+++ lib/api/2011-02-01/configuration.js    2012-11-15 18:23:42 +0900 (5bf4418)
@@ -14,7 +14,7 @@ function handleDomanValidationError(process, variables) {
   try {
     return process();
   } catch(error) {
-    if (errors.ValidationError.isValidationError(error)) {
+    if (error.isValidationError) {
       variables = variables || {
                     NAME_FIELD: 'domainName'
                   };
@@ -28,7 +28,7 @@ function handleIndexFieldValidationError(process, variables) {
   try {
     return process();
   } catch(error) {
-    if (errors.ValidationError.isValidationError(error)) {
+    if (error.isValidationError) {
       variables = variables || {
                     NAME_FIELD: 'indexField.indexFieldName',
                     TYPE_FIELD: 'indexField.indexFieldType'
@@ -291,11 +291,12 @@ function getFieldOption(option, request, type) {
 }
 
 handlers.DefineIndexField = function(context, request, response, config) {
+  var domainName = request.query.DomainName || '';
   var domain = handleDomanValidationError(function() {
-        return new Domain(request.query.DomainName || '', context);
+        return new Domain(domainName, context);
       });
-  if (!domain.exists())
-    throw new errors.NotFoundError('Domain not found: ' + domain.name);
+  if (!domain || !domain.exists())
+    throw new errors.NotFoundError('Domain not found: ' + domainName);
 
   var createdAt = new Date();
   var fieldName = request.query['IndexField.IndexFieldName'] || '';
-------------- next part --------------
HTML����������������������������...
ダウンロード 



More information about the Groonga-commit mailing list
アーカイブの一覧に戻る