From 8a6384862f6bcec65159f380f86728061e28b06b Mon Sep 17 00:00:00 2001 From: Gian Merlino Date: Mon, 2 Jun 2014 12:55:17 -0700 Subject: [PATCH] Better task log errors. --- .../io/druid/indexing/overlord/http/OverlordResource.java | 7 ++++++- .../src/main/java/io/druid/storage/s3/S3TaskLogs.java | 5 +++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/indexing-service/src/main/java/io/druid/indexing/overlord/http/OverlordResource.java b/indexing-service/src/main/java/io/druid/indexing/overlord/http/OverlordResource.java index 58c917c0a26..248d6611b48 100644 --- a/indexing-service/src/main/java/io/druid/indexing/overlord/http/OverlordResource.java +++ b/indexing-service/src/main/java/io/druid/indexing/overlord/http/OverlordResource.java @@ -398,7 +398,12 @@ public class OverlordResource if (stream.isPresent()) { return Response.ok(stream.get().getInput()).build(); } else { - return Response.status(Response.Status.NOT_FOUND).build(); + return Response.status(Response.Status.NOT_FOUND) + .entity( + "No log was found for this task. " + + "The task may not exist, or it may not have begun running yet." + ) + .build(); } } catch (Exception e) { diff --git a/s3-extensions/src/main/java/io/druid/storage/s3/S3TaskLogs.java b/s3-extensions/src/main/java/io/druid/storage/s3/S3TaskLogs.java index 572959a05ed..0463304d224 100644 --- a/s3-extensions/src/main/java/io/druid/storage/s3/S3TaskLogs.java +++ b/s3-extensions/src/main/java/io/druid/storage/s3/S3TaskLogs.java @@ -97,8 +97,9 @@ public class S3TaskLogs implements TaskLogs ); } catch (ServiceException e) { - if (e.getErrorCode() != null && (e.getErrorCode().equals("NoSuchKey") || e.getErrorCode() - .equals("NoSuchBucket"))) { + if (404 == e.getResponseCode() + || "NoSuchKey".equals(e.getErrorCode()) + || "NoSuchBucket".equals(e.getErrorCode())) { return Optional.absent(); } else { throw new IOException(String.format("Failed to stream logs from: %s", taskKey), e);