Navigation Menu

Skip to content

Commit

Permalink
bq: throw exception for invalid operator chracter
Browse files Browse the repository at this point in the history
  • Loading branch information
kou committed Aug 6, 2012
1 parent b0a6960 commit 5fe20dd
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 @@ -100,8 +100,8 @@ BooleanQueryTranslator.prototype = {
} else if (character == ")") {
this.throwTranslateError("operator is missing");
} else {
// TODO: invalid operator
return "";
this.throwTranslateError("invalid operator character: " +
"<" + character + ">");
}
}

Expand Down
4 changes: 4 additions & 0 deletions test/bq-translator.test.js
Expand Up @@ -138,6 +138,10 @@ suite('BoolanQueryTranslator', function() {
"()",
"(|)|",
"operator is missing");
testGroupError("invalid operator character",
"(operat0r f1:'k1' f2:'k2')",
"(operat|0|r f1:'k1' f2:'k2')",
"invalid operator character: <0>");

testExpression("value only: stirng: and: space",
"'keyword1 keyword2' 'other keyword'",
Expand Down

0 comments on commit 5fe20dd

Please sign in to comment.