You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@druid.apache.org by GitBox <gi...@apache.org> on 2021/10/17 13:02:03 UTC

[GitHub] [druid] FrankChen021 commented on a change in pull request #11723: Improve exception message when loading data from web-console

FrankChen021 commented on a change in pull request #11723:
URL: https://github.com/apache/druid/pull/11723#discussion_r730412089



##########
File path: indexing-service/src/main/java/org/apache/druid/indexing/overlord/sampler/SamplerExceptionMapper.java
##########
@@ -28,13 +29,21 @@
 @Provider
 public class SamplerExceptionMapper implements ExceptionMapper<SamplerException>
 {
+  private static final Logger LOG = new Logger(SamplerExceptionMapper.class);
+
   @Override
   public Response toResponse(SamplerException exception)
   {
+    String message = exception.getMessage() == null ? "The sampler encountered an issue" : exception.getMessage();
+
+    // stack trace is not returned to the client,
+    // so the cause of the exception should be logged so that we know where the exception is thrown
+    LOG.error(exception.getCause(), message);

Review comment:
       fixed. 

##########
File path: indexing-service/src/main/java/org/apache/druid/indexing/seekablestream/SeekableStreamSamplerSpec.java
##########
@@ -92,9 +93,22 @@ public SamplerResponse sample()
       );
       inputFormat = null;
     } else {
+      RecordSupplier<PartitionIdType, SequenceOffsetType, RecordType> recordSupplier;
+
+      try {
+        recordSupplier = createRecordSupplier();
+      }
+      catch (Exception e) {
+        if (e.getCause() != null) {
+          throw new SamplerException(e, "Unable to sample data: %s. Cause: %s", e.getMessage(), e.getCause().getMessage());

Review comment:
       fixed




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org