@Test void serializeNonNullClient() { ErrorMessage result = ExceptionSerializer.serialize("Client", new RuntimeException( "Something went wrong")); assertEquals("Client", result.getLocation()); }
public static ErrorMessage serialize(String clientLocation, Throwable t) { ErrorMessage.Builder builder = ErrorMessage.newBuilder() .setLocation(getOrDefault(clientLocation, "")) .setMessage(t.getMessage() == null ? t.getClass().getName() : t.getMessage()); builder.addDetails(t.getMessage() == null ? t.getClass().getName() : t.getMessage()); while (t.getCause() != null) { t = t.getCause(); builder.addDetails(t.getMessage() == null ? t.getClass().getName() : t.getMessage()); } return builder.build(); }
ExceptionSerializer { public static ErrorMessage serialize(String clientLocation, Throwable t) { ErrorMessage.Builder builder = ErrorMessage.newBuilder() .setLocation(getOrDefault(clientLocation, "")) .setMessage(t.getMessage() == null ? t.getClass().getName() : t.getMessage()); builder.addDetails(t.getMessage() == null ? t.getClass().getName() : t.getMessage()); while (t.getCause() != null) { t = t.getCause(); builder.addDetails(t.getMessage() == null ? t.getClass().getName() : t.getMessage()); } return builder.build(); } }
ExceptionSerializer { public static ErrorMessage serialize(String clientLocation, Throwable t) { ErrorMessage.Builder builder = ErrorMessage.newBuilder() .setLocation(getOrDefault(clientLocation, "")) .setMessage(t.getMessage() == null ? t.getClass().getName() : t.getMessage()); builder.addDetails(t.getMessage() == null ? t.getClass().getName() : t.getMessage()); while (t.getCause() != null) { t = t.getCause(); builder.addDetails(t.getMessage() == null ? t.getClass().getName() : t.getMessage()); } return builder.build(); } private  ExceptionSerializer(); }
ExceptionSerializer { public static ErrorMessage serialize(String clientLocation, Throwable t) { ErrorMessage.Builder builder = ErrorMessage.newBuilder() .setLocation(getOrDefault(clientLocation, "")) .setMessage(t.getMessage() == null ? t.getClass().getName() : t.getMessage()); builder.addDetails(t.getMessage() == null ? t.getClass().getName() : t.getMessage()); while (t.getCause() != null) { t = t.getCause(); builder.addDetails(t.getMessage() == null ? t.getClass().getName() : t.getMessage()); } return builder.build(); } private  ExceptionSerializer(); static ErrorMessage serialize(String clientLocation, Throwable t); }
ExceptionSerializer { public static ErrorMessage serialize(String clientLocation, Throwable t) { ErrorMessage.Builder builder = ErrorMessage.newBuilder() .setLocation(getOrDefault(clientLocation, "")) .setMessage(t.getMessage() == null ? t.getClass().getName() : t.getMessage()); builder.addDetails(t.getMessage() == null ? t.getClass().getName() : t.getMessage()); while (t.getCause() != null) { t = t.getCause(); builder.addDetails(t.getMessage() == null ? t.getClass().getName() : t.getMessage()); } return builder.build(); } private  ExceptionSerializer(); static ErrorMessage serialize(String clientLocation, Throwable t);  }