@Override
    public void syntaxError(Recognizer<?, ?> recognizer, Object offendingSymbol,
                            int line, int charPositionInLine, String msg, RecognitionException e)
        throws ParseCancellationException {
      throw new ParseCancellationException("lexer error: " + msg);
    }
The ParseErrorListener converts parse errors into ParseCancellationException.
standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/parser/PartFilterParser.java