Navigation Menu

Skip to content

Commit

Permalink
bq: throw exception for missing close parenthesis for filter
Browse files Browse the repository at this point in the history
  • Loading branch information
kou committed Aug 6, 2012
1 parent ef6a261 commit 1f41ec3
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
7 changes: 3 additions & 4 deletions lib/bq-translator.js
Expand Up @@ -159,13 +159,12 @@ BooleanQueryTranslator.prototype = {
"field:<" + field + ">");
}
} else {
// TODO: report error: invalid field character
return "";
this.throwTranslateError("invalid field character: " +
"<" + character + ">");
}
}

// TODO: report error: missing close paren <)>
return "";
this.throwTranslateError("close parenthesis is missing: operator:<filter>");
},
translateGroupSetOperation: function(setOperator) {
var expressions = [];
Expand Down
8 changes: 8 additions & 0 deletions test/bq-translator.test.js
Expand Up @@ -176,6 +176,14 @@ suite('BoolanQueryTranslator', function() {
"(filter f1)",
"(filter f1|)|",
"field value is missing: field:<f1>");
testGroupError("filter: invalid field name",
"(filter fIeld 'value')",
"(filter f|I|eld 'value')",
"invalid field character: <I>");
testGroupError("filter: missing close parenthesis",
"(filter ",
"(filter ||",
"close parenthesis is missing: operator:<filter>");

// testGroupError("and: missing close parentheis",
// "(and f1:'k1' f2:'k2'",
Expand Down

0 comments on commit 1f41ec3

Please sign in to comment.