diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/exception/InvalidServiceConnectionException.java b/openmetadata-service/src/main/java/org/openmetadata/service/exception/InvalidServiceConnectionException.java index 99d7de4f435..4948ed2faf6 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/exception/InvalidServiceConnectionException.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/exception/InvalidServiceConnectionException.java @@ -12,6 +12,10 @@ public class InvalidServiceConnectionException extends WebServiceException { super(Response.Status.BAD_REQUEST, ERROR_TYPE, message); } + public InvalidServiceConnectionException(String message, Throwable e) { + super(Response.Status.BAD_REQUEST, ERROR_TYPE, message, e); + } + private InvalidServiceConnectionException(Response.Status status, String message) { super(status, ERROR_TYPE, message); } diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/secrets/SecretsUtil.java b/openmetadata-service/src/main/java/org/openmetadata/service/secrets/SecretsUtil.java index 6da8e8318f8..754b14a5a6f 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/secrets/SecretsUtil.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/secrets/SecretsUtil.java @@ -78,17 +78,20 @@ public final class SecretsUtil { return ClassConverterFactory.getConverter(clazz).convert(connectionConfig); } catch (Exception e) { // If we have the name we are trying to encrypt a connection + String message = e.getMessage(); if (connectionName != null) { throw new InvalidServiceConnectionException( String.format( - "Failed to convert [%s] to type [%s]. Review the connection.", - connectionName, connectionType)); + "Failed to convert [%s] to type [%s]. Review the connection.\n%s", + connectionName, connectionType, message), + e); } // If we don't have the name, we are decrypting from the db throw new InvalidServiceConnectionException( String.format( - "Failed to load the connection of type [%s]. Did migrations run properly?", - connectionType)); + "Failed to load the connection of type [%s]. Did migrations run properly?\n%s", + connectionType, message), + e); } } }