summaryrefslogtreecommitdiffstats
path: root/src/main/java/net/libertacasa/pubsh/web/WebApplication.java
diff options
context:
space:
mode:
authorGeorg Pfuetzenreuter2022-05-11 17:50:30 +0200
committerGeorg Pfuetzenreuter2022-05-11 17:50:30 +0200
commit812cf73cb76eeaed530a36c8e848354d7d9269dd (patch)
treef25d3deea36f395c3c5a065c0760bbb2ee616c19 /src/main/java/net/libertacasa/pubsh/web/WebApplication.java
parent1a4e969557a31c97a66c3769fa242513dc66d1be (diff)
downloadpubsh-web-812cf73cb76eeaed530a36c8e848354d7d9269dd.tar.gz
pubsh-web-812cf73cb76eeaed530a36c8e848354d7d9269dd.tar.bz2
pubsh-web-812cf73cb76eeaed530a36c8e848354d7d9269dd.zip
Shell deletion exception handling
Signed-off-by: Georg Pfuetzenreuter <mail@georg-pfuetzenreuter.net>
Diffstat (limited to 'src/main/java/net/libertacasa/pubsh/web/WebApplication.java')
-rw-r--r--src/main/java/net/libertacasa/pubsh/web/WebApplication.java14
1 files changed, 13 insertions, 1 deletions
diff --git a/src/main/java/net/libertacasa/pubsh/web/WebApplication.java b/src/main/java/net/libertacasa/pubsh/web/WebApplication.java
index a22c390..55628fe 100644
--- a/src/main/java/net/libertacasa/pubsh/web/WebApplication.java
+++ b/src/main/java/net/libertacasa/pubsh/web/WebApplication.java
@@ -276,7 +276,19 @@ public class WebApplication {
System.out.printf("Deletion triggered for ID %s by %s (%s)\n", id, userid, username);
- Docker.deleteShell(username, id);
+ try {
+ Docker.deleteShell(username, id);
+ String returnmessage = "Ok, deleted the shell with container ID " + id;
+ redirectAttributes.addFlashAttribute("message", returnmessage);
+ } catch (com.github.dockerjava.api.exception.NotFoundException exception) {
+ String returnmessage = "Shell does not exist, maybe it already expired?";
+ redirectAttributes.addFlashAttribute("message", returnmessage);
+ System.out.println(exception);
+ } catch (Exception exception) {
+ String returnmessage = "Error.";
+ redirectAttributes.addFlashAttribute("message", returnmessage);
+ System.out.println(exception);
+ }
return("redirect:/portal");
}