diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/solutions/ce/ImportExportApplicationServiceCEImpl.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/solutions/ce/ImportExportApplicationServiceCEImpl.java index 428a1da88f..e9d88fd0c6 100644 --- a/app/server/appsmith-server/src/main/java/com/appsmith/server/solutions/ce/ImportExportApplicationServiceCEImpl.java +++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/solutions/ce/ImportExportApplicationServiceCEImpl.java @@ -954,7 +954,7 @@ public class ImportExportApplicationServiceCEImpl implements ImportExportApplica private String validateApplicationJson(ApplicationJson importedDoc) { String errorField = ""; if (CollectionUtils.isEmpty(importedDoc.getPageList())) { - errorField = FieldName.PAGES; + errorField = FieldName.PAGE_LIST; } else if (importedDoc.getExportedApplication() == null) { errorField = FieldName.APPLICATION; } else if (importedDoc.getActionList() == null) { @@ -1835,7 +1835,8 @@ public class ImportExportApplicationServiceCEImpl implements ImportExportApplica String errorField = validateApplicationJson(importedDoc); if (!errorField.isEmpty()) { log.error("Error in importing application. Field {} is missing", errorField); - return Mono.error(new AppsmithException(AppsmithError.NO_RESOURCE_FOUND, errorField, INVALID_JSON_FILE)); + return Mono.error(new AppsmithException( + AppsmithError.VALIDATION_FAILURE, "Field '" + errorField + "' is missing in the JSON.")); } Application importedApplication = importedDoc.getExportedApplication(); diff --git a/app/server/appsmith-server/src/test/java/com/appsmith/server/solutions/ImportExportApplicationServiceTests.java b/app/server/appsmith-server/src/test/java/com/appsmith/server/solutions/ImportExportApplicationServiceTests.java index 07e25034da..9c33e45d88 100644 --- a/app/server/appsmith-server/src/test/java/com/appsmith/server/solutions/ImportExportApplicationServiceTests.java +++ b/app/server/appsmith-server/src/test/java/com/appsmith/server/solutions/ImportExportApplicationServiceTests.java @@ -842,7 +842,8 @@ public class ImportExportApplicationServiceTests { .expectErrorMatches(throwable -> throwable instanceof AppsmithException && throwable .getMessage() - .equals(AppsmithError.NO_RESOURCE_FOUND.getMessage(FieldName.PAGES, INVALID_JSON_FILE))) + .equals(AppsmithError.VALIDATION_FAILURE.getMessage( + "Field '" + FieldName.PAGE_LIST + "' is missing in the JSON."))) .verify(); } @@ -858,8 +859,8 @@ public class ImportExportApplicationServiceTests { .expectErrorMatches(throwable -> throwable instanceof AppsmithException && throwable .getMessage() - .equals(AppsmithError.NO_RESOURCE_FOUND.getMessage( - FieldName.APPLICATION, INVALID_JSON_FILE))) + .equals(AppsmithError.VALIDATION_FAILURE.getMessage( + "Field '" + FieldName.APPLICATION + "' is missing in the JSON."))) .verify(); } @@ -4198,7 +4199,8 @@ public class ImportExportApplicationServiceTests { .expectErrorMatches(throwable -> throwable instanceof AppsmithException && throwable .getMessage() - .equals(AppsmithError.NO_RESOURCE_FOUND.getMessage(FieldName.PAGES, INVALID_JSON_FILE))) + .equals(AppsmithError.VALIDATION_FAILURE.getMessage( + "Field '" + FieldName.PAGE_LIST + "' is missing in the JSON."))) .verify(); // Verify that the app card is not created