Skip to content

Commit

Permalink
Minor secret utils error log (#18856)
Browse files Browse the repository at this point in the history
* fix: pass exception message in SecretUtils.convert

* fix: pass throwable

(cherry picked from commit fc01035)
  • Loading branch information
TeddyCr committed Nov 29, 2024
1 parent 262c20f commit c38cf55
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ public InvalidServiceConnectionException(String message) {
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);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,17 +78,20 @@ public static Object convert(
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);
}
}
}

0 comments on commit c38cf55

Please sign in to comment.