From 4693b0a6ac7bcb408eef3aac67d1052082ce9ae9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Magdalena=20Grodzi=C5=84ska?= Date: Wed, 20 Nov 2019 14:20:39 +0100 Subject: Add exception message to query submission --- .../pl/edu/mimuw/cloudatlas/client/ClientController.java | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'src/main/java') diff --git a/src/main/java/pl/edu/mimuw/cloudatlas/client/ClientController.java b/src/main/java/pl/edu/mimuw/cloudatlas/client/ClientController.java index ea39a3d..bdc71df 100644 --- a/src/main/java/pl/edu/mimuw/cloudatlas/client/ClientController.java +++ b/src/main/java/pl/edu/mimuw/cloudatlas/client/ClientController.java @@ -47,14 +47,26 @@ public class ClientController { @PostMapping("/query") public String submitQuery(@ModelAttribute Query queryObject, Model model) { + boolean success = true; + try { this.api.installQuery(queryObject.getName(), queryObject.getValue()); } catch (Exception e) { + success = false; System.err.println("Client exception:"); e.printStackTrace(); } - model.addAttribute("homeMessage", "Query submitted successfully"); + if (success) { + model.addAttribute( + "homeMessage", + "Query submitted successfully"); + } else { + model.addAttribute( + "homeMessage", + "Query submission failed with a remote exception"); + } + return "home"; } -- cgit v1.2.3