From 7d27393efaf6367250977f5174d880ce453f25c9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Bosdonnat?= Date: Wed, 11 May 2022 15:28:32 +0200 Subject: [PATCH] Fix error display when generating containerized proxy config --- .../com/suse/manager/webui/controllers/ProxyController.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/java/code/src/com/suse/manager/webui/controllers/ProxyController.java b/java/code/src/com/suse/manager/webui/controllers/ProxyController.java index efd12efc09ba..e16e43ee34e4 100644 --- a/java/code/src/com/suse/manager/webui/controllers/ProxyController.java +++ b/java/code/src/com/suse/manager/webui/controllers/ProxyController.java @@ -25,6 +25,7 @@ import com.redhat.rhn.common.RhnRuntimeException; import com.redhat.rhn.domain.user.User; import com.redhat.rhn.manager.system.SystemManager; +import com.redhat.rhn.manager.system.SystemsExistException; import com.suse.manager.reactor.utils.LocalDateTimeISOAdapter; import com.suse.manager.reactor.utils.OptionalTypeAdapterFactory; @@ -128,6 +129,11 @@ public String generateContainerConfig(Request request, Response response, User u return json(response, HttpStatus.SC_INTERNAL_SERVER_ERROR, "Failed to generate proxy container configuration"); } + catch (SystemsExistException e) { + String msg = String.format("Cannot create proxy as an existing system has FQDN '%s'", data.getProxyFqdn()); + LOG.error(msg); + return json(response, HttpStatus.SC_INTERNAL_SERVER_ERROR, msg); + } catch (RhnRuntimeException e) { return json(response, HttpStatus.SC_BAD_REQUEST, e.getMessage()); }