@Test void shouldSerializeThrowable() { Throwable e = new RuntimeException("oops"); Errors.ContainerError error = ProtoUtil.serializeThrowable(e); assertThat(error.getKind(), equalTo(Errors.ContainerError.Kind.NON_RECOVERABLE)); assertThat(error.getMessage(), containsString(e.getMessage())); assertThat(error.getCode(), equalTo("SYSTEM:Unknown")); }
static Errors.ContainerError serializeThrowable(Throwable e) { StringWriter sw = new StringWriter(); e.printStackTrace(new PrintWriter(sw)); return Errors.ContainerError.newBuilder() .setCode("SYSTEM:Unknown") .setKind(Errors.ContainerError.Kind.NON_RECOVERABLE) .setMessage(sw.toString()) .build(); }
ProtoUtil { static Errors.ContainerError serializeThrowable(Throwable e) { StringWriter sw = new StringWriter(); e.printStackTrace(new PrintWriter(sw)); return Errors.ContainerError.newBuilder() .setCode("SYSTEM:Unknown") .setKind(Errors.ContainerError.Kind.NON_RECOVERABLE) .setMessage(sw.toString()) .build(); } }
ProtoUtil { static Errors.ContainerError serializeThrowable(Throwable e) { StringWriter sw = new StringWriter(); e.printStackTrace(new PrintWriter(sw)); return Errors.ContainerError.newBuilder() .setCode("SYSTEM:Unknown") .setKind(Errors.ContainerError.Kind.NON_RECOVERABLE) .setMessage(sw.toString()) .build(); } private  ProtoUtil(); }
ProtoUtil { static Errors.ContainerError serializeThrowable(Throwable e) { StringWriter sw = new StringWriter(); e.printStackTrace(new PrintWriter(sw)); return Errors.ContainerError.newBuilder() .setCode("SYSTEM:Unknown") .setKind(Errors.ContainerError.Kind.NON_RECOVERABLE) .setMessage(sw.toString()) .build(); } private  ProtoUtil(); static Workflow.WorkflowTemplate serialize(WorkflowTemplate template); }
ProtoUtil { static Errors.ContainerError serializeThrowable(Throwable e) { StringWriter sw = new StringWriter(); e.printStackTrace(new PrintWriter(sw)); return Errors.ContainerError.newBuilder() .setCode("SYSTEM:Unknown") .setKind(Errors.ContainerError.Kind.NON_RECOVERABLE) .setMessage(sw.toString()) .build(); } private  ProtoUtil(); static Workflow.WorkflowTemplate serialize(WorkflowTemplate template);  }