cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Tyler Hobbs (JIRA)" <j...@apache.org>
Subject [jira] [Comment Edited] (CASSANDRA-7111) Include snippet of CQL query near error in SyntaxError messages
Date Wed, 09 Jul 2014 21:39:05 GMT

    [ https://issues.apache.org/jira/browse/CASSANDRA-7111?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14056782#comment-14056782
] 

Tyler Hobbs edited comment on CASSANDRA-7111 at 7/9/14 9:38 PM:
----------------------------------------------------------------

Overall, this looks great!

I have a few nitpicks:

 * It would be nice to add a space between the token and the snippet.  For example, between
{{'ks'}} and {{(}} here: {{"line 1:9 missing K_FROM at 'ks'\(select * \[ks\];\)"}}.
 * I think we can reasonably make {{FIRST_TOKEN_OFFSET}} 10 instead of 6
 * There are a few places where you don't put the opening curly brace on a newline (ErrorCollector
ctor, insertChar(), lineIndex(), getSnippetLastTokenIndex(), getSnippetFirstTokenIndex(),
...)
 * Single line conditionals and loops don't need curlies (ErrorCollector.syntaxError(), appendSnippet(),
throwLastSyntaxError())
 * There's quite a bit of trailing whitespace in the patch


was (Author: thobbs):
Overall, this looks great!

I have a few nitpicks:

 * It would be nice to add a space between the token and the snippet.  For example, between
{{'ks'}} and {{(}} here: {{"line 1:9 missing K_FROM at 'ks'\(select * \[ks\]\;\)"}}.
 * I think we can reasonably make {{FIRST_TOKEN_OFFSET}} 10 instead of 6
 * There are a few places where you don't put the opening curly brace on a newline (ErrorCollector
ctor, insertChar(), lineIndex(), getSnippetLastTokenIndex(), getSnippetFirstTokenIndex(),
...)
 * Single line conditionals and loops don't need curlies (ErrorCollector.syntaxError(), appendSnippet(),
throwLastSyntaxError())
 * There's quite a bit of trailing whitespace in the patch

> Include snippet of CQL query near error in SyntaxError messages
> ---------------------------------------------------------------
>
>                 Key: CASSANDRA-7111
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-7111
>             Project: Cassandra
>          Issue Type: Improvement
>          Components: API, Tools
>            Reporter: Tyler Hobbs
>            Assignee: Benjamin Lerer
>              Labels: cql
>             Fix For: 2.1.1
>
>         Attachments: CASSANDRA-7111.txt
>
>
> When a SyntaxError is returned, including a snippet of the query close to the error would
make a lot of error messages easier to understand.  For example, if you did this with the
python driver:
> {code}
> session.execute(SELECT * FROM users WHERE username='%s', ['Joe Smith'])
> {code}
> you would wind up with an extra set of single quotes (the driver automatically escapes
and quotes input).  If a snippet like {{...WHERE username=''Joe Smith''}} were included in
the error message, this would be pretty easy to spot.



--
This message was sent by Atlassian JIRA
(v6.2#6252)

Mime
View raw message