fix: modified error code for unauthorised trigger and execute calls (#28946)
## Description > Introduced a new error to address Appsmith Error type handling Plugin authentication errors #### PR fixes following issue(s) Fixes # (issue number) #### Type of change - Bug fix (non-breaking change which fixes an issue) #### How Has This Been Tested? > Please describe the tests that you ran to verify your changes. Also list any relevant details for your test configuration. > Delete anything that is not relevant - [ ] Manual - [ ] JUnit - [ ] Jest - [ ] Cypress #### Issues raised during DP testing > Link issues raised during DP testing for better visiblity and tracking (copy link from comments dropped on this PR) > > > ## Checklist: #### Dev activity - [ ] My code follows the style guidelines of this project - [ ] I have performed a self-review of my own code - [ ] I have commented my code, particularly in hard-to-understand areas - [ ] I have made corresponding changes to the documentation - [ ] My changes generate no new warnings - [ ] I have added tests that prove my fix is effective or that my feature works - [ ] New and existing unit tests pass locally with my changes - [ ] PR is being merged under a feature flag #### QA activity: - [ ] [Speedbreak features](https://github.com/appsmithorg/TestSmith/wiki/Guidelines-for-test-plans#speedbreakers-) have been covered - [ ] Test plan covers all impacted features and [areas of interest](https://github.com/appsmithorg/TestSmith/wiki/Guidelines-for-test-plans#areas-of-interest-) - [ ] Test plan has been peer reviewed by project stakeholders and other QA members - [ ] Manually tested functionality on DP - [ ] We had an implementation alignment call with stakeholders post QA Round 2 - [ ] Cypress test cases have been added and approved by SDET/manual QA - [ ] Added `Test Plan Approved` label after Cypress tests were reviewed - [ ] Added `Test Plan Approved` label after JUnit tests were reviewed
This commit is contained in:
parent
856d2ad812
commit
2214abc1bf
|
|
@ -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(),
|
||||
|
|
|
|||
|
|
@ -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"),
|
||||
|
|
|
|||
|
|
@ -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()));
|
||||
});
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user