vdiravka commented on a change in pull request #1455: DRILL-6724: Convert 
IndexOutOfBounds exception to UserException with …
URL: https://github.com/apache/drill/pull/1455#discussion_r214548608
 
 

 ##########
 File path: 
exec/java-exec/src/main/java/org/apache/drill/exec/store/easy/sequencefile/SequenceFileRecordReader.java
 ##########
 @@ -163,4 +163,23 @@ public void close() {
       logger.warn("Exception closing reader: {}", e);
     }
   }
+
+  @Override
+  public UserException createDataReadException(Throwable cause, String 
message) {
+    UserException.Builder builder = UserException.dataReadError(cause)
+        .message(message)
+        .addContext("File ", split.getPath().toString());
+    long position = -1L;
+    try {
+      if (reader != null) {
+        position = reader.getPos();
+      }
+    } catch (IOException e) {
+      // Ignore as this is to provide information only
+    }
+    if (position > 0) {
+      builder.addContext("Position ", position);
+    }
+    return builder.build(logger);
+  }
 }
 
 Review comment:
   Please add new line in the eof

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to