Skip to content

Commit

Permalink
log ajql
Browse files Browse the repository at this point in the history
  • Loading branch information
devezhao committed Dec 3, 2023
1 parent 92c7777 commit a04af4d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

<groupId>cn.devezhao</groupId>
<artifactId>persist4j</artifactId>
<version>1.7.5</version>
<version>1.7.6</version>
<packaging>jar</packaging>

<name>persist4j</name>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ public String compile(SqlExecutorContext context, Filter filter) throws CompileE
try {
parser.statement();
} catch (Exception ex) {
handleParseException(ex);
handleParseException(ex, ajql);
}
compiledSql = compileQuery( parser.getAST(), filter );
return compiledSql;
Expand Down Expand Up @@ -249,7 +249,7 @@ private String compileQuery(AST select, Filter filter) {
try {
parser.whereClause();
} catch (Exception ex) {
handleParseException(ex);
handleParseException(ex, fstrs);
}

AST nood = parser.getAST();
Expand Down Expand Up @@ -820,18 +820,19 @@ private void throwIfUncompile() {
throw new IllegalStateException("uncompile");
}
}

/**
* @param ex
* @param ajql
*/
private void handleParseException(Exception ex) {
private void handleParseException(Exception ex, String ajql) {
if (ex instanceof ParserException) {
Throwable cause = ex.getCause();
throw new CompileException(
"ANTLR cannot parse AjQL stream, threw an exception [ "
+ cause.getClass().getName() + ": " + ex.getCause() + " ]", ex.getCause());
+ cause.getClass().getName() + ": " + ex.getCause() + " {" + ajql + "} ]", ex.getCause());
}
throw new CompileException("Parse AjQL error", ex);
throw new CompileException("Parse AjQL error {" + ajql + "}", ex);
}

// ----------------------------------------------------------- Just for Nested SQL
Expand Down

0 comments on commit a04af4d

Please sign in to comment.