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

ASF GitHub Bot commented on CALCITE-508:
----------------------------------------

Github user vlsi commented on a diff in the pull request:

    https://github.com/apache/calcite-avatica/pull/23#discussion_r164958640
  
    --- Diff: 
core/src/main/java/org/apache/calcite/avatica/util/IteratorCursor.java ---
    @@ -68,7 +68,7 @@ public void close() {
     
       protected E current() {
         if (position != Position.OK) {
    -      throw new NoSuchElementException();
    +      throw new NoSuchElementException("Invalid cursor position");
    --- End diff --
    
    Please add actual position to the exception message.
    
    Consider what would engineer do with `Invalid cursor position`. Why is the 
position invalid?
    I would be much better if error message was `Expecting cursor position to 
be Position.OK, actual is ...`


> Reading from ResultSet before calling next() should throw SQLException not 
> NoSuchElementException
> -------------------------------------------------------------------------------------------------
>
>                 Key: CALCITE-508
>                 URL: https://issues.apache.org/jira/browse/CALCITE-508
>             Project: Calcite
>          Issue Type: Bug
>            Reporter: Julian Hyde
>            Assignee: Julian Hyde
>            Priority: Major
>              Labels: newbie
>
> Reading from ResultSet before calling next() should throw SQLException not 
> NoSuchElementException.
> Each of the Cursor.Accessor.getXxx methods should convert runtime exceptions 
> to SQLException.
> JdbcTest.testExtract currently demonstrates this problem; it passes if there 
> is a NoSuchElementException, but should look for a SQLException.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to