You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@asterixdb.apache.org by Eugenia Gabrielova <ge...@gmail.com> on 2015/06/08 09:44:50 UTC

REST API error code question for Invalid Statements (API docs nitpick)

Hello! This is a docs/code matchup nitpick question.

*Question: *Reality or docs: which is correct error-code for Invalid
Statements submitted to AsterixDB REST API? Why aren't Algebricks and
Hyracks Exceptions documented in the REST API, though they have their own
error-codes?

*Version: *0.8.7 Master

*Proposed Solutions: *Add an error code for instances of AsterixException,
and/or update API docs to reflect actual behavior.

*Details: *Working on some test cases for errors for the JS SDK. According
to the REST API docs (https://asterixdb.ics.uci.edu/documentation/api.html),
a REST API call with an Invalid Statement should return error-code 1.

When I submit a query statement to the DDL endpoint, I observe error code
99.

*use dataverse test_company;*
*for $ds in dataset Metadata.Dataset return $ds;*
 [*99*,
  'Invalid statement: Non-DDL statement QUERY to the DDL API.
[AsterixException]' ]

*What I've tried so far: *I noticed in
*asterix-app/src/main/java/edu/uci/ics/asterix/result/ResultUtils.java* that
an Invalid Statement error-code 1 is not set, so the 99 code I am observing
makes sense. I also noticed that Algebricks and Hyracks exceptions are not
*210     public static void apiErrorHandler(PrintWriter out, Exception e) {*
*211         int errorCode = 99;*
*212         if (e instanceof ParseException) {*
*213             errorCode = 2;*
*214         } else if (e instanceof AlgebricksException) {*
*215             errorCode = 3;*
*216         } else if (e instanceof HyracksDataException) {*
*217             errorCode = 4;*
*218         }*

Thanks!
Eugenia

Re: REST API error code question for Invalid Statements (API docs nitpick)

Posted by Eugenia Gabrielova <ge...@gmail.com>.
I'd be happy to check the logs and provide that information, if it would
help. Is that something I would find in the asterixdb cc log?

On Mon, Jun 8, 2015 at 11:33 AM, Ian Maxon <im...@uci.edu> wrote:

> Hey Eugenia,
>
> Good catch. This is certainly a bug.
> Regarding the classification of exceptions,HyracksException and
> HyracksDataException are pretty broad. It can be anything from network to
> disk to "this shouldn't happen" type of exceptions.
> It would be interesting to see if that erroneous query had it's exception
> casted into something else along the way, or if it just threw an exception
> that wasn't anticipated as one that would be returned for a bad query.
>
> - Ian
>
> On Mon, Jun 8, 2015 at 12:44 AM, Eugenia Gabrielova <
> genia.likes.science@gmail.com> wrote:
>
>> Hello! This is a docs/code matchup nitpick question.
>>
>> *Question: *Reality or docs: which is correct error-code for Invalid
>> Statements submitted to AsterixDB REST API? Why aren't Algebricks and
>> Hyracks Exceptions documented in the REST API, though they have their own
>> error-codes?
>>
>> *Version: *0.8.7 Master
>>
>> *Proposed Solutions: *Add an error code for instances of
>> AsterixException, and/or update API docs to reflect actual behavior.
>>
>> *Details: *Working on some test cases for errors for the JS SDK.
>> According to the REST API docs (
>> https://asterixdb.ics.uci.edu/documentation/api.html), a REST API call
>> with an Invalid Statement should return error-code 1.
>>
>> When I submit a query statement to the DDL endpoint, I observe error code
>> 99.
>>
>> *use dataverse test_company;*
>> *for $ds in dataset Metadata.Dataset return $ds;*
>>  [*99*,
>>   'Invalid statement: Non-DDL statement QUERY to the DDL API.
>> [AsterixException]' ]
>>
>> *What I've tried so far: *I noticed in
>> *asterix-app/src/main/java/edu/uci/ics/asterix/result/ResultUtils.java* that
>> an Invalid Statement error-code 1 is not set, so the 99 code I am observing
>> makes sense. I also noticed that Algebricks and Hyracks exceptions are not
>> *210     public static void apiErrorHandler(PrintWriter out, Exception e)
>> {*
>> *211         int errorCode = 99;*
>> *212         if (e instanceof ParseException) {*
>> *213             errorCode = 2;*
>> *214         } else if (e instanceof AlgebricksException) {*
>> *215             errorCode = 3;*
>> *216         } else if (e instanceof HyracksDataException) {*
>> *217             errorCode = 4;*
>> *218         }*
>>
>> Thanks!
>> Eugenia
>>
>>  --
>> You received this message because you are subscribed to the Google Groups
>> "asterixdb-users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to asterixdb-users+unsubscribe@googlegroups.com.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>

Re: REST API error code question for Invalid Statements (API docs nitpick)

Posted by Ian Maxon <im...@uci.edu>.
Hey Eugenia,

Good catch. This is certainly a bug.
Regarding the classification of exceptions,HyracksException and
HyracksDataException are pretty broad. It can be anything from network to
disk to "this shouldn't happen" type of exceptions.
It would be interesting to see if that erroneous query had it's exception
casted into something else along the way, or if it just threw an exception
that wasn't anticipated as one that would be returned for a bad query.

- Ian

On Mon, Jun 8, 2015 at 12:44 AM, Eugenia Gabrielova <
genia.likes.science@gmail.com> wrote:

> Hello! This is a docs/code matchup nitpick question.
>
> *Question: *Reality or docs: which is correct error-code for Invalid
> Statements submitted to AsterixDB REST API? Why aren't Algebricks and
> Hyracks Exceptions documented in the REST API, though they have their own
> error-codes?
>
> *Version: *0.8.7 Master
>
> *Proposed Solutions: *Add an error code for instances of
> AsterixException, and/or update API docs to reflect actual behavior.
>
> *Details: *Working on some test cases for errors for the JS SDK.
> According to the REST API docs (
> https://asterixdb.ics.uci.edu/documentation/api.html), a REST API call
> with an Invalid Statement should return error-code 1.
>
> When I submit a query statement to the DDL endpoint, I observe error code
> 99.
>
> *use dataverse test_company;*
> *for $ds in dataset Metadata.Dataset return $ds;*
>  [*99*,
>   'Invalid statement: Non-DDL statement QUERY to the DDL API.
> [AsterixException]' ]
>
> *What I've tried so far: *I noticed in
> *asterix-app/src/main/java/edu/uci/ics/asterix/result/ResultUtils.java* that
> an Invalid Statement error-code 1 is not set, so the 99 code I am observing
> makes sense. I also noticed that Algebricks and Hyracks exceptions are not
> *210     public static void apiErrorHandler(PrintWriter out, Exception e)
> {*
> *211         int errorCode = 99;*
> *212         if (e instanceof ParseException) {*
> *213             errorCode = 2;*
> *214         } else if (e instanceof AlgebricksException) {*
> *215             errorCode = 3;*
> *216         } else if (e instanceof HyracksDataException) {*
> *217             errorCode = 4;*
> *218         }*
>
> Thanks!
> Eugenia
>
>  --
> You received this message because you are subscribed to the Google Groups
> "asterixdb-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to asterixdb-users+unsubscribe@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>