YUKI Hiroshi
null+****@clear*****
Thu Nov 15 17:21:49 JST 2012
YUKI Hiroshi 2012-11-15 17:21:49 +0900 (Thu, 15 Nov 2012) New Revision: f321d8df0c08c1c369844ce0935f2302cfd5ad0c https://github.com/groonga/gcs/commit/f321d8df0c08c1c369844ce0935f2302cfd5ad0c Log: Don't embed validated field name to validation errors on the internal layer Modified files: lib/database/domain.js lib/database/index-field.js test/database-domain.test.js test/database-index-field.test.js Modified: lib/database/domain.js (+1 -1) =================================================================== --- lib/database/domain.js 2012-11-15 17:15:58 +0900 (5aa34ce) +++ lib/database/domain.js 2012-11-15 17:21:49 +0900 (3e8af6c) @@ -61,7 +61,7 @@ function assertValidDomainName(domain) { } var errors = []; - var commonPrefix = 'Value \'' + domain + '\' at \'domainName\' failed ' + + var commonPrefix = 'Value \'' + domain + '\' at \'%VALIDATED_FIELD_NAME%\' failed ' + 'to satisfy constraint: '; if (!domain.match(VALID_NAME_MATCHER)) { Modified: lib/database/index-field.js (+1 -1) =================================================================== --- lib/database/index-field.js 2012-11-15 17:15:58 +0900 (c6a19c6) +++ lib/database/index-field.js 2012-11-15 17:21:49 +0900 (bfe2213) @@ -34,7 +34,7 @@ function assertValidFieldName(field) { } var errors = []; - var commonPrefix = 'Value \'' + field + '\' at \'indexField.indexFieldName\' failed ' + + var commonPrefix = 'Value \'' + field + '\' at \'%VALIDATED_FIELD_NAME%\' failed ' + 'to satisfy constraint: '; if (!field.match(VALID_NAME_MATCHER)) { Modified: test/database-domain.test.js (+11 -11) =================================================================== --- test/database-domain.test.js 2012-11-15 17:15:58 +0900 (110616d) +++ test/database-domain.test.js 2012-11-15 17:21:49 +0900 (11e9a04) @@ -41,10 +41,10 @@ suite('database', function() { assert.throw(function() { var domain = new Domain(''); }, '2 validation errors detected: ' + - 'Value \'\' at \'domainName\' failed to satisfy constraint: ' + + 'Value \'\' at \'%VALIDATED_FIELD_NAME%\' failed to satisfy constraint: ' + 'Member must satisfy regular expression pattern: ' + Domain.VALID_NAME_PATTERN + '; ' + - 'Value \'\' at \'domainName\' failed to satisfy constraint: ' + + 'Value \'\' at \'%VALIDATED_FIELD_NAME%\' failed to satisfy constraint: ' + 'Member must have length greater than or equal to ' + Domain.MINIMUM_NAME_LENGTH); }); @@ -53,10 +53,10 @@ suite('database', function() { assert.throw(function() { var domain = new Domain('v'); }, '2 validation errors detected: ' + - 'Value \'v\' at \'domainName\' failed to satisfy constraint: ' + + 'Value \'v\' at \'%VALIDATED_FIELD_NAME%\' failed to satisfy constraint: ' + 'Member must satisfy regular expression pattern: ' + Domain.VALID_NAME_PATTERN + '; ' + - 'Value \'v\' at \'domainName\' failed to satisfy constraint: ' + + 'Value \'v\' at \'%VALIDATED_FIELD_NAME%\' failed to satisfy constraint: ' + 'Member must have length greater than or equal to ' + Domain.MINIMUM_NAME_LENGTH); }); @@ -65,7 +65,7 @@ suite('database', function() { assert.throw(function() { var domain = new Domain('va'); }, '1 validation error detected: ' + - 'Value \'va\' at \'domainName\' failed to satisfy constraint: ' + + 'Value \'va\' at \'%VALIDATED_FIELD_NAME%\' failed to satisfy constraint: ' + 'Member must have length greater than or equal to ' + Domain.MINIMUM_NAME_LENGTH); }); @@ -75,7 +75,7 @@ suite('database', function() { assert.throw(function() { var domain = new Domain(name); }, '1 validation error detected: ' + - 'Value \'' + name + '\' at \'domainName\' failed to satisfy constraint: ' + + 'Value \'' + name + '\' at \'%VALIDATED_FIELD_NAME%\' failed to satisfy constraint: ' + 'Member must have length less than or equal to ' + Domain.MAXIMUM_NAME_LENGTH); }); @@ -84,7 +84,7 @@ suite('database', function() { assert.throw(function() { var domain = new Domain('domain-name'); }, '1 validation error detected: ' + - 'Value \'domain_name\' at \'domainName\' failed to satisfy constraint: ' + + 'Value \'domain_name\' at \'%VALIDATED_FIELD_NAME%\' failed to satisfy constraint: ' + 'Member cannot include these characters: \'-\''); }); @@ -92,7 +92,7 @@ suite('database', function() { assert.throw(function() { var domain = new Domain('domain_name'); }, '1 validation error detected: ' + - 'Value \'domain_name\' at \'domainName\' failed to satisfy constraint: ' + + 'Value \'domain_name\' at \'%VALIDATED_FIELD_NAME%\' failed to satisfy constraint: ' + 'Member must satisfy regular expression pattern: ' + Domain.VALID_NAME_PATTERN); }); @@ -101,7 +101,7 @@ suite('database', function() { assert.throw(function() { var domain = new Domain('DomainName'); }, '1 validation error detected: ' + - 'Value \'DomainName\' at \'domainName\' failed to satisfy constraint: ' + + 'Value \'%VALIDATED_FIELD_NAME%\' at \'%VALIDATED_FIELD_NAME%\' failed to satisfy constraint: ' + 'Member must satisfy regular expression pattern: ' + Domain.VALID_NAME_PATTERN); }); @@ -195,7 +195,7 @@ suite('database', function() { var request = { headers: { host: host } }; var domain = new Domain(request); }, '1 validation error detected: ' + - 'Value \'domain_name\' at \'domainName\' failed to satisfy constraint: ' + + 'Value \'domain_name\' at \'%VALIDATED_FIELD_NAME%\' failed to satisfy constraint: ' + 'Member must satisfy regular expression pattern: ' + Domain.VALID_NAME_PATTERN); }); @@ -216,7 +216,7 @@ suite('database', function() { url: '/gcs/test_0123-id0123' }; var domain = new Domain(request); }, '1 validation error detected: ' + - 'Value \'domain_name\' at \'domainName\' failed to satisfy constraint: ' + + 'Value \'domain_name\' at \'%VALIDATED_FIELD_NAME%\' failed to satisfy constraint: ' + 'Member must satisfy regular expression pattern: ' + Domain.VALID_NAME_PATTERN); }); Modified: test/database-index-field.test.js (+6 -6) =================================================================== --- test/database-index-field.test.js 2012-11-15 17:15:58 +0900 (19ea368) +++ test/database-index-field.test.js 2012-11-15 17:21:49 +0900 (85f0acf) @@ -45,10 +45,10 @@ suite('database', function() { assert.throw(function() { var field = new IndexField('v', domain); }, '2 validation errors detected: ' + - 'Value \'v\' at \'indexField.indexFieldName\' failed to satisfy constraint: ' + + 'Value \'v\' at \'%VALIDATED_FIELD_NAME%\' failed to satisfy constraint: ' + 'Member must satisfy regular expression pattern: ' + IndexField.VALID_NAME_PATTERN + '; ' + - 'Value \'v\' at \'indexField.indexFieldName\' failed to satisfy constraint: ' + + 'Value \'v\' at \'%VALIDATED_FIELD_NAME%\' failed to satisfy constraint: ' + 'Member must have length greater than or equal to ' + IndexField.MINIMUM_NAME_LENGTH); }); @@ -57,7 +57,7 @@ suite('database', function() { assert.throw(function() { var field = new IndexField('va', domain); }, '1 validation error detected: ' + - 'Value \'va\' at \'indexField.indexFieldName\' failed to satisfy constraint: ' + + 'Value \'va\' at \'%VALIDATED_FIELD_NAME%\' failed to satisfy constraint: ' + 'Member must have length greater than or equal to ' + IndexField.MINIMUM_NAME_LENGTH); }); @@ -67,7 +67,7 @@ suite('database', function() { assert.throw(function() { var field = new IndexField(name, domain); }, '1 validation error detected: ' + - 'Value \'' + name + '\' at \'indexField.indexFieldName\' failed to satisfy constraint: ' + + 'Value \'' + name + '\' at \'%VALIDATED_FIELD_NAME%\' failed to satisfy constraint: ' + 'Member must have length less than or equal to ' + IndexField.MAXIMUM_NAME_LENGTH); }); @@ -76,7 +76,7 @@ suite('database', function() { assert.throw(function() { var field = new IndexField('field-name', domain); }, '1 validation error detected: ' + - 'Value \'field-name\' at \'indexField.indexFieldName\' failed to satisfy constraint: ' + + 'Value \'field-name\' at \'%VALIDATED_FIELD_NAME%\' failed to satisfy constraint: ' + 'Member cannot include these characters: \'-\''); }); @@ -89,7 +89,7 @@ suite('database', function() { assert.throw(function() { var field = new IndexField('FieldName'); }, '1 validation error detected: ' + - 'Value \'FieldName\' at \'indexField.indexFieldName\' failed to satisfy constraint: ' + + 'Value \'FieldName\' at \'%VALIDATED_FIELD_NAME%\' failed to satisfy constraint: ' + 'Member must satisfy regular expression pattern: ' + IndexField.VALID_NAME_PATTERN); }); -------------- next part -------------- HTML����������������������������...Download