diff --git a/src/main/java/tech/justen/concord/goodwill/service/GrpcDockerService.java b/src/main/java/tech/justen/concord/goodwill/service/GrpcDockerService.java index 6ae4e3b..223c930 100644 --- a/src/main/java/tech/justen/concord/goodwill/service/GrpcDockerService.java +++ b/src/main/java/tech/justen/concord/goodwill/service/GrpcDockerService.java @@ -34,7 +34,7 @@ public void runContainer(DockerContainerSpec request, StreamObserver value) { } public static StatusRuntimeException toStatusException(Exception ex) { - return Status.INTERNAL.withDescription(ex.getMessage()).withCause(ex).asRuntimeException(); + return Status.INTERNAL.withDescription(exceptionDescription(ex)).withCause(ex).asRuntimeException(); } public static StatusRuntimeException toStatusException(ApiException ex, String desc) { @@ -210,4 +213,16 @@ public static StatusRuntimeException toStatusException(ApiException ex, String d } return status.withDescription(ex.getMessage()).withCause(ex).asRuntimeException(); } + + private static String exceptionDescription(Throwable ex) { + StringWriter sw = new StringWriter(); + sw.append(ex.getClass().getName()); + if (ex.getMessage() != null) { + sw.append(": "); + sw.append(ex.getMessage()); + sw.append('\n'); + } + ex.printStackTrace(new PrintWriter(sw)); + return sw.toString(); + } }