Merge branch 'bug/duplicate-key-error-status-code' into 'release'
In case of duplicate key, send the application error code instead of http error code See merge request theappsmith/internal-tools-server!177
This commit is contained in:
commit
86df807ed5
|
|
@ -7,7 +7,6 @@ import java.text.MessageFormat;
|
|||
@Getter
|
||||
public enum AppsmithError {
|
||||
|
||||
NO_RESOURCE_FOUND(404, 1000, "Unable to find {0} with id {1}"),
|
||||
INVALID_PARAMETER(400, 4000, "Invalid parameter {0} provided in the input"),
|
||||
PLUGIN_NOT_INSTALLED(400, 4001, "Plugin {0} not installed"),
|
||||
PLUGIN_ID_NOT_GIVEN(400, 4002, "Missing plugin id. Please input correct plugin id"),
|
||||
|
|
@ -20,19 +19,18 @@ public enum AppsmithError {
|
|||
NO_CONFIGURATION_FOUND_IN_DATASOURCE(400, 4011, "Datasource without any configuration is invalid. Please try again with datasourceConfiguration"),
|
||||
INVALID_ACTION(400, 4012, "Action is invalid. Please edit to make it valid"),
|
||||
INVALID_DATASOURCE(400, 4013, "Datasource is invalid. Please edit to make it valid"),
|
||||
INVALID_ACTION_NAME(400, 4014, "Action name is invalid. Please input syntactically correct name"),
|
||||
INVALID_DATASOURCE_CONFIGURATION(400, 4015, "Datasource configuration is invalid"),
|
||||
NO_CONFIGURATION_FOUND_IN_ACTION(400, 4016, "Action without any configuration is invalid. Please try again with actionConfiguration"),
|
||||
NAME_CLASH_NOT_ALLOWED_IN_REFACTOR(400, 4017, "Unable to change the name {0} to {1} because {1} already exists in the current page"),
|
||||
PAGE_DOESNT_BELONG_TO_APPLICATION(400, 4018, "Page {0} does not belong to the application {1}"),
|
||||
UNAUTHORIZED_DOMAIN(401, 4012, "Invalid email domain provided. Please sign in with a valid work email ID"),
|
||||
UNAUTHORIZED_ACCESS(401, 4013, "Unauthorized access"),
|
||||
INVALID_ACTION_NAME(401, 4014, "Action name is invalid. Please input syntactically correct name"),
|
||||
INVALID_DATASOURCE_NAME(401, 4017, "Datasource name is invalid"),
|
||||
DUPLICATE_KEY(401, 4018, "Duplicate key error"),
|
||||
GENERIC_BAD_REQUEST(401, 4019, "Bad Request: {0}"),
|
||||
UNAUTHORIZED_DOMAIN(401, 4019, "Invalid email domain provided. Please sign in with a valid work email ID"),
|
||||
INVALID_PASSWORD_RESET(400, 4020, "Unable to reset the password. Please initiate a request via 'forgot password' link to reset your password"),
|
||||
LOGIN_INTERNAL_ERROR(401, 4021, "Internal error while trying to login"),
|
||||
INVALID_CREDENTIALS(200, 4022, "Invalid credentials provided. Did you input the credentials correctly?"),
|
||||
NO_RESOURCE_FOUND(404, 4021, "Unable to find {0} with id {1}"),
|
||||
UNAUTHORIZED_ACCESS(401, 4022, "Unauthorized access"),
|
||||
INVALID_DATASOURCE_NAME(400, 4023, "Datasource name is invalid"),
|
||||
DUPLICATE_KEY(409, 4024, "Duplicate key error"),
|
||||
GENERIC_BAD_REQUEST(400, 4025, "Bad Request: {0}"),
|
||||
INTERNAL_SERVER_ERROR(500, 5000, "Internal server error while processing request"),
|
||||
REPOSITORY_SAVE_FAILED(500, 5001, "Repository save failed"),
|
||||
PLUGIN_INSTALLATION_FAILED_DOWNLOAD_ERROR(500, 5002, "Due to error in downloading the plugin from remote repository, plugin installation has failed. Check the jar location and try again"),
|
||||
|
|
|
|||
|
|
@ -54,7 +54,7 @@ public class GlobalExceptionHandler {
|
|||
exchange.getResponse().setStatusCode(HttpStatus.BAD_REQUEST);
|
||||
log.error("", e);
|
||||
rollbar.log(e);
|
||||
return Mono.just(new ResponseDTO<>(HttpStatus.BAD_REQUEST.value(), new ErrorDTO(AppsmithError.DUPLICATE_KEY.getHttpErrorCode(),
|
||||
return Mono.just(new ResponseDTO<>(HttpStatus.BAD_REQUEST.value(), new ErrorDTO(AppsmithError.DUPLICATE_KEY.getAppErrorCode(),
|
||||
AppsmithError.DUPLICATE_KEY.getMessage())));
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user