diff --git a/merlin-server/src/main/java/gov/nasa/jpl/aerie/merlin/server/http/ResponseSerializers.java b/merlin-server/src/main/java/gov/nasa/jpl/aerie/merlin/server/http/ResponseSerializers.java index 82589af52b..b592f621da 100644 --- a/merlin-server/src/main/java/gov/nasa/jpl/aerie/merlin/server/http/ResponseSerializers.java +++ b/merlin-server/src/main/java/gov/nasa/jpl/aerie/merlin/server/http/ResponseSerializers.java @@ -189,12 +189,12 @@ public static JsonValue serializeBulkArgumentValidationResponse(BulkArgumentVali return Json.createObjectBuilder(serializeInstantiationException(f.ex()).asJsonObject()) .add("type", "INSTANTIATION_ERRORS") .build(); - } else if (response instanceof BulkArgumentValidationResponse.RuntimeError e) { + } else if (response instanceof BulkArgumentValidationResponse.RuntimeException e) { return Json.createObjectBuilder() .add("success", JsonValue.FALSE) .add("type", "RUNTIME_EXCEPTION") - .add("errors", Json.createArrayBuilder() - .add(e.t().getMessage()) + .add("errors", Json.createObjectBuilder() + .add("runtimeException", e.t().getMessage()) .build()) .build(); } @@ -202,8 +202,8 @@ public static JsonValue serializeBulkArgumentValidationResponse(BulkArgumentVali // This should never happen, but we don't have exhaustive pattern matching return Json.createObjectBuilder() .add("success", JsonValue.FALSE) - .add("errors", Json.createArrayBuilder() - .add(String.format("Internal error: %s", response)) + .add("errors", Json.createObjectBuilder() + .add("internalError", response.toString()) .build()) .build(); } diff --git a/merlin-server/src/main/java/gov/nasa/jpl/aerie/merlin/server/services/LocalMissionModelService.java b/merlin-server/src/main/java/gov/nasa/jpl/aerie/merlin/server/services/LocalMissionModelService.java index 12b319a285..2c74003875 100644 --- a/merlin-server/src/main/java/gov/nasa/jpl/aerie/merlin/server/services/LocalMissionModelService.java +++ b/merlin-server/src/main/java/gov/nasa/jpl/aerie/merlin/server/services/LocalMissionModelService.java @@ -165,7 +165,7 @@ public List validateActivityArgumentsBulk( } catch (InstantiationException e) { return new BulkArgumentValidationResponse.InstantiationError(e); } catch (Throwable t) { - return new BulkArgumentValidationResponse.RuntimeError(t); + return new BulkArgumentValidationResponse.RuntimeException(t); } }).collect(Collectors.toList()); } diff --git a/merlin-server/src/main/java/gov/nasa/jpl/aerie/merlin/server/services/MissionModelService.java b/merlin-server/src/main/java/gov/nasa/jpl/aerie/merlin/server/services/MissionModelService.java index 2e179be570..029c90675d 100644 --- a/merlin-server/src/main/java/gov/nasa/jpl/aerie/merlin/server/services/MissionModelService.java +++ b/merlin-server/src/main/java/gov/nasa/jpl/aerie/merlin/server/services/MissionModelService.java @@ -109,6 +109,6 @@ record Success() implements BulkArgumentValidationResponse { } record Validation(List notices) implements BulkArgumentValidationResponse { } record NoSuchActivityError(NoSuchActivityTypeException ex) implements BulkArgumentValidationResponse { } record InstantiationError(InstantiationException ex) implements BulkArgumentValidationResponse { } - record RuntimeError(Throwable t) implements BulkArgumentValidationResponse { } + record RuntimeException(Throwable t) implements BulkArgumentValidationResponse { } } }