Navigation Menu

Skip to content

Commit

Permalink
bq: throw exception for invalid value
Browse files Browse the repository at this point in the history
  • Loading branch information
kou committed Aug 6, 2012
1 parent f18b72d commit 6b55ec3
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/bq-translator.js
Expand Up @@ -218,8 +218,8 @@ BooleanQueryTranslator.prototype = {
if (/^[0-9.]/.test(this.query[this.offset])) {
return this.translateExpressionValueUnsignedInteger(field);
}
// TODO: report error
return "";

this.throwTranslateError("invalid value: field:<" + field + ">");
},
translateExpressionValueString: function(field) {
if (this.query[this.offset] != "'") {
Expand Down
4 changes: 4 additions & 0 deletions test/bq-translator.test.js
Expand Up @@ -258,4 +258,8 @@ suite('BoolanQueryTranslator', function() {
"f1 'k1'",
"f1| |'k1'",
"field value separator is missing");
testExpressionError("invalid value",
"f1:value",
"f1:|v|alue",
"invalid value: field:<f1>");
});

0 comments on commit 6b55ec3

Please sign in to comment.