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 3a9b4e383f..74f827b977 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 @@ -9,7 +9,8 @@ import java.text.MessageFormat; @Getter public enum AppsmithPluginError { - PLUGIN_ERROR(500, 5000, "{0}", AppsmithErrorAction.LOG_EXTERNALLY, "Query execution error", ErrorType.INTERNAL_ERROR), + PLUGIN_ERROR(500, 5000, "{0}", + AppsmithErrorAction.LOG_EXTERNALLY, "Query execution error", ErrorType.INTERNAL_ERROR), PLUGIN_GET_STRUCTURE_ERROR(500, 5001, "{0}", AppsmithErrorAction.DEFAULT, "Failed to get datasource " + "structure", ErrorType.INTERNAL_ERROR), PLUGIN_QUERY_TIMEOUT_ERROR(504, 5002, "{0} timed out in {1} milliseconds. " + @@ -21,8 +22,9 @@ public enum AppsmithPluginError { PLUGIN_GET_STRUCTURE_TIMEOUT_ERROR(504, 5003, "{0}", AppsmithErrorAction.LOG_EXTERNALLY, "Timed out when fetching" + " datasource structure", ErrorType.CONNECTIVITY_ERROR), PLUGIN_DATASOURCE_ARGUMENT_ERROR(500, 5004, "{0}", AppsmithErrorAction.DEFAULT, "Datasource configuration is " + - "invalid", ErrorType.ARGUMENT_ERROR), - PLUGIN_EXECUTE_ARGUMENT_ERROR(500, 5005, "{0}", AppsmithErrorAction.DEFAULT, "Query configuration is invalid", ErrorType.ARGUMENT_ERROR), + "invalid", ErrorType.DATASOURCE_CONFIGURATION_ERROR), + PLUGIN_EXECUTE_ARGUMENT_ERROR(500, 5005, "{0}", AppsmithErrorAction.DEFAULT, + "Query configuration is invalid", ErrorType.ACTION_CONFIGURATION_ERROR), PLUGIN_JSON_PARSE_ERROR(500, 5006, "Plugin failed to parse JSON \"{0}\" with error: {1}", AppsmithErrorAction.DEFAULT, "Invalid JSON found", ErrorType.INTERNAL_ERROR), PLUGIN_DATASOURCE_TEST_GENERIC_ERROR(500, 5007, "Plugin failed to test with the given configuration. Please reach out to Appsmith customer support to report this", diff --git a/app/server/appsmith-interfaces/src/main/java/com/appsmith/external/models/ErrorType.java b/app/server/appsmith-interfaces/src/main/java/com/appsmith/external/models/ErrorType.java index a553351845..aeefee4ee9 100644 --- a/app/server/appsmith-interfaces/src/main/java/com/appsmith/external/models/ErrorType.java +++ b/app/server/appsmith-interfaces/src/main/java/com/appsmith/external/models/ErrorType.java @@ -10,6 +10,7 @@ public enum ErrorType { CONNECTIVITY_ERROR, AUTHENTICATION_ERROR, BAD_REQUEST, - INTERNAL_ERROR + INTERNAL_ERROR, + ACTION_CONFIGURATION_ERROR } diff --git a/app/server/appsmith-plugins/googleSheetsPlugin/src/main/java/com/external/config/AppendMethod.java b/app/server/appsmith-plugins/googleSheetsPlugin/src/main/java/com/external/config/AppendMethod.java index 50f5f84535..81ad5afbaa 100644 --- a/app/server/appsmith-plugins/googleSheetsPlugin/src/main/java/com/external/config/AppendMethod.java +++ b/app/server/appsmith-plugins/googleSheetsPlugin/src/main/java/com/external/config/AppendMethod.java @@ -37,19 +37,19 @@ public class AppendMethod implements Method { @Override public boolean validateMethodRequest(MethodConfig methodConfig) { if (methodConfig.getSpreadsheetId() == null || methodConfig.getSpreadsheetId().isBlank()) { - throw new AppsmithPluginException(AppsmithPluginError.PLUGIN_ERROR, "Missing required field Spreadsheet Url"); + throw new AppsmithPluginException(AppsmithPluginError.PLUGIN_EXECUTE_ARGUMENT_ERROR, "Missing required field Spreadsheet Url"); } if (methodConfig.getSheetName() == null || methodConfig.getSheetName().isBlank()) { - throw new AppsmithPluginException(AppsmithPluginError.PLUGIN_ERROR, "Missing required field Sheet name"); + throw new AppsmithPluginException(AppsmithPluginError.PLUGIN_EXECUTE_ARGUMENT_ERROR, "Missing required field Sheet name"); } if (methodConfig.getTableHeaderIndex() != null && !methodConfig.getTableHeaderIndex().isBlank()) { try { if (Integer.parseInt(methodConfig.getTableHeaderIndex()) <= 0) { - throw new AppsmithPluginException(AppsmithPluginError.PLUGIN_ERROR, + throw new AppsmithPluginException(AppsmithPluginError.PLUGIN_EXECUTE_ARGUMENT_ERROR, "Unexpected value for table header index. Please use a number starting from 1"); } } catch (NumberFormatException e) { - throw new AppsmithPluginException(AppsmithPluginError.PLUGIN_ERROR, + throw new AppsmithPluginException(AppsmithPluginError.PLUGIN_EXECUTE_ARGUMENT_ERROR, "Unexpected format for table header index. Please use a number starting from 1"); } } diff --git a/app/server/appsmith-plugins/googleSheetsPlugin/src/main/java/com/external/config/BulkAppendMethod.java b/app/server/appsmith-plugins/googleSheetsPlugin/src/main/java/com/external/config/BulkAppendMethod.java index 66c2d30842..2aa9de6a4c 100644 --- a/app/server/appsmith-plugins/googleSheetsPlugin/src/main/java/com/external/config/BulkAppendMethod.java +++ b/app/server/appsmith-plugins/googleSheetsPlugin/src/main/java/com/external/config/BulkAppendMethod.java @@ -38,19 +38,19 @@ public class BulkAppendMethod implements Method { @Override public boolean validateMethodRequest(MethodConfig methodConfig) { if (methodConfig.getSpreadsheetId() == null || methodConfig.getSpreadsheetId().isBlank()) { - throw new AppsmithPluginException(AppsmithPluginError.PLUGIN_ERROR, "Missing required field Spreadsheet Url"); + throw new AppsmithPluginException(AppsmithPluginError.PLUGIN_EXECUTE_ARGUMENT_ERROR, "Missing required field Spreadsheet Url"); } if (methodConfig.getSheetName() == null || methodConfig.getSheetName().isBlank()) { - throw new AppsmithPluginException(AppsmithPluginError.PLUGIN_ERROR, "Missing required field Sheet name"); + throw new AppsmithPluginException(AppsmithPluginError.PLUGIN_EXECUTE_ARGUMENT_ERROR, "Missing required field Sheet name"); } if (methodConfig.getTableHeaderIndex() != null && !methodConfig.getTableHeaderIndex().isBlank()) { try { if (Integer.parseInt(methodConfig.getTableHeaderIndex()) <= 0) { - throw new AppsmithPluginException(AppsmithPluginError.PLUGIN_ERROR, + throw new AppsmithPluginException(AppsmithPluginError.PLUGIN_EXECUTE_ARGUMENT_ERROR, "Unexpected value for table header index. Please use a number starting from 1"); } } catch (NumberFormatException e) { - throw new AppsmithPluginException(AppsmithPluginError.PLUGIN_ERROR, + throw new AppsmithPluginException(AppsmithPluginError.PLUGIN_EXECUTE_ARGUMENT_ERROR, "Unexpected format for table header index. Please use a number starting from 1"); } } diff --git a/app/server/appsmith-plugins/googleSheetsPlugin/src/main/java/com/external/config/BulkUpdateMethod.java b/app/server/appsmith-plugins/googleSheetsPlugin/src/main/java/com/external/config/BulkUpdateMethod.java index 1d1830e26e..7cab693e1f 100644 --- a/app/server/appsmith-plugins/googleSheetsPlugin/src/main/java/com/external/config/BulkUpdateMethod.java +++ b/app/server/appsmith-plugins/googleSheetsPlugin/src/main/java/com/external/config/BulkUpdateMethod.java @@ -38,19 +38,19 @@ public class BulkUpdateMethod implements Method { @Override public boolean validateMethodRequest(MethodConfig methodConfig) { if (methodConfig.getSpreadsheetId() == null || methodConfig.getSpreadsheetId().isBlank()) { - throw new AppsmithPluginException(AppsmithPluginError.PLUGIN_ERROR, "Missing required field Spreadsheet Url"); + throw new AppsmithPluginException(AppsmithPluginError.PLUGIN_EXECUTE_ARGUMENT_ERROR, "Missing required field Spreadsheet Url"); } if (methodConfig.getSheetName() == null || methodConfig.getSheetName().isBlank()) { - throw new AppsmithPluginException(AppsmithPluginError.PLUGIN_ERROR, "Missing required field Sheet name"); + throw new AppsmithPluginException(AppsmithPluginError.PLUGIN_EXECUTE_ARGUMENT_ERROR, "Missing required field Sheet name"); } if (methodConfig.getTableHeaderIndex() != null && !methodConfig.getTableHeaderIndex().isBlank()) { try { if (Integer.parseInt(methodConfig.getTableHeaderIndex()) <= 0) { - throw new AppsmithPluginException(AppsmithPluginError.PLUGIN_ERROR, + throw new AppsmithPluginException(AppsmithPluginError.PLUGIN_EXECUTE_ARGUMENT_ERROR, "Unexpected value for table header index. Please use a number starting from 1"); } } catch (NumberFormatException e) { - throw new AppsmithPluginException(AppsmithPluginError.PLUGIN_ERROR, + throw new AppsmithPluginException(AppsmithPluginError.PLUGIN_EXECUTE_ARGUMENT_ERROR, "Unexpected format for table header index. Please use a number starting from 1"); } } diff --git a/app/server/appsmith-plugins/googleSheetsPlugin/src/main/java/com/external/config/ClearMethod.java b/app/server/appsmith-plugins/googleSheetsPlugin/src/main/java/com/external/config/ClearMethod.java index a232cceb5b..330b4c9ba6 100644 --- a/app/server/appsmith-plugins/googleSheetsPlugin/src/main/java/com/external/config/ClearMethod.java +++ b/app/server/appsmith-plugins/googleSheetsPlugin/src/main/java/com/external/config/ClearMethod.java @@ -22,10 +22,10 @@ public class ClearMethod implements Method { @Override public boolean validateMethodRequest(MethodConfig methodConfig) { if (methodConfig.getSpreadsheetId() == null || methodConfig.getSpreadsheetId().isBlank()) { - throw new AppsmithPluginException(AppsmithPluginError.PLUGIN_ERROR, "Missing required field Spreadsheet Url"); + throw new AppsmithPluginException(AppsmithPluginError.PLUGIN_EXECUTE_ARGUMENT_ERROR, "Missing required field Spreadsheet Url"); } if (methodConfig.getSpreadsheetRange() == null || methodConfig.getSpreadsheetRange().isBlank()) { - throw new AppsmithPluginException(AppsmithPluginError.PLUGIN_ERROR, "Missing required field Data Range"); + throw new AppsmithPluginException(AppsmithPluginError.PLUGIN_EXECUTE_ARGUMENT_ERROR, "Missing required field Data Range"); } return true; diff --git a/app/server/appsmith-plugins/googleSheetsPlugin/src/main/java/com/external/config/CopyMethod.java b/app/server/appsmith-plugins/googleSheetsPlugin/src/main/java/com/external/config/CopyMethod.java index 4b60e3f012..36a09c7806 100644 --- a/app/server/appsmith-plugins/googleSheetsPlugin/src/main/java/com/external/config/CopyMethod.java +++ b/app/server/appsmith-plugins/googleSheetsPlugin/src/main/java/com/external/config/CopyMethod.java @@ -22,10 +22,10 @@ public class CopyMethod implements Method { @Override public boolean validateMethodRequest(MethodConfig methodConfig) { if (methodConfig.getSpreadsheetId() == null || methodConfig.getSpreadsheetId().isBlank()) { - throw new AppsmithPluginException(AppsmithPluginError.PLUGIN_ERROR, "Missing required field Spreadsheet Url"); + throw new AppsmithPluginException(AppsmithPluginError.PLUGIN_EXECUTE_ARGUMENT_ERROR, "Missing required field Spreadsheet Url"); } if (methodConfig.getSheetId() == null || methodConfig.getSheetId().isBlank()) { - throw new AppsmithPluginException(AppsmithPluginError.PLUGIN_ERROR, "Missing required field Sheet Id"); + throw new AppsmithPluginException(AppsmithPluginError.PLUGIN_EXECUTE_ARGUMENT_ERROR, "Missing required field Sheet Id"); } return true; } diff --git a/app/server/appsmith-plugins/googleSheetsPlugin/src/main/java/com/external/config/DeleteRowMethod.java b/app/server/appsmith-plugins/googleSheetsPlugin/src/main/java/com/external/config/DeleteRowMethod.java index cad077c1c8..f064f713ac 100644 --- a/app/server/appsmith-plugins/googleSheetsPlugin/src/main/java/com/external/config/DeleteRowMethod.java +++ b/app/server/appsmith-plugins/googleSheetsPlugin/src/main/java/com/external/config/DeleteRowMethod.java @@ -30,33 +30,33 @@ public class DeleteRowMethod implements Method { @Override public boolean validateMethodRequest(MethodConfig methodConfig) { if (methodConfig.getSpreadsheetId() == null || methodConfig.getSpreadsheetId().isBlank()) { - throw new AppsmithPluginException(AppsmithPluginError.PLUGIN_ERROR, "Missing required field Spreadsheet Url"); + throw new AppsmithPluginException(AppsmithPluginError.PLUGIN_EXECUTE_ARGUMENT_ERROR, "Missing required field Spreadsheet Url"); } if (methodConfig.getSheetName() == null || methodConfig.getSheetName().isBlank()) { - throw new AppsmithPluginException(AppsmithPluginError.PLUGIN_ERROR, "Missing required field Sheet name"); + throw new AppsmithPluginException(AppsmithPluginError.PLUGIN_EXECUTE_ARGUMENT_ERROR, "Missing required field Sheet name"); } if (methodConfig.getRowIndex() == null || methodConfig.getRowIndex().isBlank()) { - throw new AppsmithPluginException(AppsmithPluginError.PLUGIN_ERROR, "Missing required field Row index"); + throw new AppsmithPluginException(AppsmithPluginError.PLUGIN_EXECUTE_ARGUMENT_ERROR, "Missing required field Row index"); } int rowIndex = 0; try { rowIndex = Integer.parseInt(methodConfig.getRowIndex()); if (rowIndex < 0) { - throw new AppsmithPluginException(AppsmithPluginError.PLUGIN_ERROR, + throw new AppsmithPluginException(AppsmithPluginError.PLUGIN_EXECUTE_ARGUMENT_ERROR, "Unexpected value for row index. Please use a number starting from 0"); } } catch (NumberFormatException e) { - throw new AppsmithPluginException(AppsmithPluginError.PLUGIN_ERROR, + throw new AppsmithPluginException(AppsmithPluginError.PLUGIN_EXECUTE_ARGUMENT_ERROR, "Unexpected format for row index. Please use a number starting from 0"); } if (methodConfig.getTableHeaderIndex() != null && !methodConfig.getTableHeaderIndex().isBlank()) { try { if (Integer.parseInt(methodConfig.getTableHeaderIndex()) <= 0) { - throw new AppsmithPluginException(AppsmithPluginError.PLUGIN_ERROR, + throw new AppsmithPluginException(AppsmithPluginError.PLUGIN_EXECUTE_ARGUMENT_ERROR, "Unexpected value for table header index. Please use a number starting from 1"); } } catch (NumberFormatException e) { - throw new AppsmithPluginException(AppsmithPluginError.PLUGIN_ERROR, + throw new AppsmithPluginException(AppsmithPluginError.PLUGIN_EXECUTE_ARGUMENT_ERROR, "Unexpected format for table header index. Please use a number starting from 1"); } } diff --git a/app/server/appsmith-plugins/googleSheetsPlugin/src/main/java/com/external/config/UpdateMethod.java b/app/server/appsmith-plugins/googleSheetsPlugin/src/main/java/com/external/config/UpdateMethod.java index 9bb5104a0d..9e4d4c05d4 100644 --- a/app/server/appsmith-plugins/googleSheetsPlugin/src/main/java/com/external/config/UpdateMethod.java +++ b/app/server/appsmith-plugins/googleSheetsPlugin/src/main/java/com/external/config/UpdateMethod.java @@ -35,19 +35,19 @@ public class UpdateMethod implements Method { @Override public boolean validateMethodRequest(MethodConfig methodConfig) { if (methodConfig.getSpreadsheetId() == null || methodConfig.getSpreadsheetId().isBlank()) { - throw new AppsmithPluginException(AppsmithPluginError.PLUGIN_ERROR, "Missing required field Spreadsheet Url"); + throw new AppsmithPluginException(AppsmithPluginError.PLUGIN_EXECUTE_ARGUMENT_ERROR, "Missing required field Spreadsheet Url"); } if (methodConfig.getSheetName() == null || methodConfig.getSheetName().isBlank()) { - throw new AppsmithPluginException(AppsmithPluginError.PLUGIN_ERROR, "Missing required field Sheet name"); + throw new AppsmithPluginException(AppsmithPluginError.PLUGIN_EXECUTE_ARGUMENT_ERROR, "Missing required field Sheet name"); } if (methodConfig.getTableHeaderIndex() != null && !methodConfig.getTableHeaderIndex().isBlank()) { try { if (Integer.parseInt(methodConfig.getTableHeaderIndex()) <= 0) { - throw new AppsmithPluginException(AppsmithPluginError.PLUGIN_ERROR, + throw new AppsmithPluginException(AppsmithPluginError.PLUGIN_EXECUTE_ARGUMENT_ERROR, "Unexpected value for table header index. Please use a number starting from 1"); } } catch (NumberFormatException e) { - throw new AppsmithPluginException(AppsmithPluginError.PLUGIN_ERROR, + throw new AppsmithPluginException(AppsmithPluginError.PLUGIN_EXECUTE_ARGUMENT_ERROR, "Unexpected format for table header index. Please use a number starting from 1"); } } diff --git a/app/server/appsmith-plugins/googleSheetsPlugin/src/main/java/com/external/domains/RowObject.java b/app/server/appsmith-plugins/googleSheetsPlugin/src/main/java/com/external/domains/RowObject.java index db17321f15..94d3198c34 100644 --- a/app/server/appsmith-plugins/googleSheetsPlugin/src/main/java/com/external/domains/RowObject.java +++ b/app/server/appsmith-plugins/googleSheetsPlugin/src/main/java/com/external/domains/RowObject.java @@ -63,12 +63,12 @@ public class RowObject { public RowObject initialize() { if (this.rowIndex == null) { - throw new AppsmithPluginException(AppsmithPluginError.PLUGIN_ERROR, "Missing required field row index."); + throw new AppsmithPluginException(AppsmithPluginError.PLUGIN_EXECUTE_ARGUMENT_ERROR, "Missing required field row index."); } try { this.currentRowIndex = Integer.parseInt(this.rowIndex); } catch (NumberFormatException e) { - throw new AppsmithPluginException(AppsmithPluginError.PLUGIN_ERROR, "Unable to parse row index: " + this.rowIndex); + throw new AppsmithPluginException(AppsmithPluginError.PLUGIN_EXECUTE_ARGUMENT_ERROR, "Unable to parse row index: " + this.rowIndex); } return this; } diff --git a/app/server/appsmith-plugins/restApiPlugin/src/main/java/com/external/plugins/RestApiPlugin.java b/app/server/appsmith-plugins/restApiPlugin/src/main/java/com/external/plugins/RestApiPlugin.java index 88d38febaf..e1d05f5c63 100644 --- a/app/server/appsmith-plugins/restApiPlugin/src/main/java/com/external/plugins/RestApiPlugin.java +++ b/app/server/appsmith-plugins/restApiPlugin/src/main/java/com/external/plugins/RestApiPlugin.java @@ -233,7 +233,7 @@ public class RestApiPlugin extends BasePlugin { ActionExecutionRequest actionExecutionRequest = RequestCaptureFilter.populateRequestFields(actionConfiguration, null, insertedParams, objectMapper); actionExecutionRequest.setUrl(url); - errorResult.setBody(AppsmithPluginError.PLUGIN_ERROR.getMessage(e)); + errorResult.setBody(AppsmithPluginError.PLUGIN_EXECUTE_ARGUMENT_ERROR.getMessage(e)); errorResult.setRequest(actionExecutionRequest); return Mono.just(errorResult); } @@ -242,7 +242,7 @@ public class RestApiPlugin extends BasePlugin { RequestCaptureFilter.populateRequestFields(actionConfiguration, uri, insertedParams, objectMapper); if (httpMethod == null) { - errorResult.setBody(AppsmithPluginError.PLUGIN_ERROR.getMessage("HTTPMethod must be set.")); + errorResult.setBody(AppsmithPluginError.PLUGIN_EXECUTE_ARGUMENT_ERROR.getMessage("HTTPMethod must be set.")); errorResult.setRequest(actionExecutionRequest); return Mono.just(errorResult); } @@ -264,7 +264,7 @@ public class RestApiPlugin extends BasePlugin { // Check for content type final String contentTypeError = verifyContentType(actionConfiguration.getHeaders()); if (contentTypeError != null) { - errorResult.setBody(AppsmithPluginError.PLUGIN_ERROR.getMessage("Invalid value for Content-Type.")); + errorResult.setBody(AppsmithPluginError.PLUGIN_EXECUTE_ARGUMENT_ERROR.getMessage("Invalid value for Content-Type.")); errorResult.setRequest(actionExecutionRequest); return Mono.just(errorResult); }