diff --git a/app/server/appsmith-interfaces/src/main/java/com/appsmith/external/exceptions/pluginExceptions/AppsmithPluginError.java b/app/server/appsmith-interfaces/src/main/java/com/appsmith/external/exceptions/pluginExceptions/AppsmithPluginError.java index 802f016235..9f5b575b81 100644 --- a/app/server/appsmith-interfaces/src/main/java/com/appsmith/external/exceptions/pluginExceptions/AppsmithPluginError.java +++ b/app/server/appsmith-interfaces/src/main/java/com/appsmith/external/exceptions/pluginExceptions/AppsmithPluginError.java @@ -107,6 +107,15 @@ public enum AppsmithPluginError implements BasePluginError { ErrorType.AUTHENTICATION_ERROR, "{0}", "{1}"), + PLUGIN_DATASOURCE_AUTHENTICATION_ERROR( + 400, + AppsmithPluginErrorCode.PLUGIN_DATASOURCE_AUTHENTICATION_ERROR.getCode(), + "Invalid authentication credentials. Please check datasource configuration.", + AppsmithErrorAction.DEFAULT, + "Datasource authentication error", + ErrorType.DATASOURCE_CONFIGURATION_ERROR, + "{0}", + "{1}"), PLUGIN_DATASOURCE_ERROR( 400, AppsmithPluginErrorCode.PLUGIN_DATASOURCE_ERROR.getCode(), diff --git a/app/server/appsmith-interfaces/src/main/java/com/appsmith/external/exceptions/pluginExceptions/AppsmithPluginErrorCode.java b/app/server/appsmith-interfaces/src/main/java/com/appsmith/external/exceptions/pluginExceptions/AppsmithPluginErrorCode.java index 7e6465e4ab..7e482eefa3 100644 --- a/app/server/appsmith-interfaces/src/main/java/com/appsmith/external/exceptions/pluginExceptions/AppsmithPluginErrorCode.java +++ b/app/server/appsmith-interfaces/src/main/java/com/appsmith/external/exceptions/pluginExceptions/AppsmithPluginErrorCode.java @@ -17,6 +17,7 @@ public enum AppsmithPluginErrorCode { PLUGIN_DATASOURCE_TIMEOUT_ERROR("PE-DSE-5004", "Timed out when connecting to datasource"), PLUGIN_QUERY_TIMEOUT_ERROR("PE-QRY-5000", "Timed out on query execution"), PLUGIN_AUTHENTICATION_ERROR("PE-ATH-5000", "Datasource authentication error"), + PLUGIN_DATASOURCE_AUTHENTICATION_ERROR("PE-ATH-4000", "Datasource authentication error"), PLUGIN_DATASOURCE_ERROR("PE-DSE-4000", "Datasource error"), PLUGIN_UQI_WHERE_CONDITION_UNKNOWN("PE-UQI-5000", "Where condition could not be parsed"), GENERIC_STALE_CONNECTION("PE-STC-5000", "Secondary stale connection error"), diff --git a/app/server/appsmith-plugins/openAiPlugin/src/main/java/com/external/plugins/OpenAiPlugin.java b/app/server/appsmith-plugins/openAiPlugin/src/main/java/com/external/plugins/OpenAiPlugin.java index 22acc5f477..dc181441e4 100644 --- a/app/server/appsmith-plugins/openAiPlugin/src/main/java/com/external/plugins/OpenAiPlugin.java +++ b/app/server/appsmith-plugins/openAiPlugin/src/main/java/com/external/plugins/OpenAiPlugin.java @@ -111,8 +111,8 @@ public class OpenAiPlugin extends BasePlugin { if (HttpStatusCode.valueOf(401).isSameCodeAs(statusCode)) { actionExecutionResult.setIsExecutionSuccess(false); - actionExecutionResult.setErrorInfo( - new AppsmithPluginException(AppsmithPluginError.PLUGIN_AUTHENTICATION_ERROR)); + actionExecutionResult.setErrorInfo(new AppsmithPluginException( + AppsmithPluginError.PLUGIN_DATASOURCE_AUTHENTICATION_ERROR)); return Mono.just(actionExecutionResult); } @@ -183,8 +183,8 @@ public class OpenAiPlugin extends BasePlugin { return RequestUtils.makeRequest(httpMethod, uri, bearerTokenAuth, BodyInserters.empty()) .flatMap(responseEntity -> { if (responseEntity.getStatusCode().is4xxClientError()) { - return Mono.error( - new AppsmithPluginException(AppsmithPluginError.PLUGIN_AUTHENTICATION_ERROR)); + return Mono.error(new AppsmithPluginException( + AppsmithPluginError.PLUGIN_DATASOURCE_AUTHENTICATION_ERROR)); } if (!responseEntity.getStatusCode().is2xxSuccessful()) { @@ -237,12 +237,13 @@ public class OpenAiPlugin extends BasePlugin { } AppsmithPluginException error = - new AppsmithPluginException(AppsmithPluginError.PLUGIN_AUTHENTICATION_ERROR); + new AppsmithPluginException(AppsmithPluginError.PLUGIN_DATASOURCE_AUTHENTICATION_ERROR); return new DatasourceTestResult(error.getMessage()); }) .onErrorResume(error -> { if (!(error instanceof AppsmithPluginException)) { - error = new AppsmithPluginException(AppsmithPluginError.PLUGIN_AUTHENTICATION_ERROR); + error = new AppsmithPluginException( + AppsmithPluginError.PLUGIN_DATASOURCE_AUTHENTICATION_ERROR); } return Mono.just(new DatasourceTestResult(error.getMessage())); });