Skip to content

Commit feadcc7

Browse files
authored
Merge pull request #41175 from appsmithorg/release
11/08 Daily Promotion
2 parents 6227d74 + 9acfafd commit feadcc7

File tree

2 files changed

+18
-3
lines changed

2 files changed

+18
-3
lines changed

app/server/appsmith-server/src/main/java/com/appsmith/server/git/fs/GitFSServiceCEImpl.java

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,13 +182,26 @@ public Mono<Tuple2<ArtifactType, String>> obtainArtifactTypeAndIdentifierFromGit
182182
return obtainArtifactTypeFromGitRepository(jsonTransformationDTO).zipWith(Mono.just(""));
183183
}
184184

185+
protected Mono<ArtifactType> handleErrorWhileArtifactTypeIdentification(Throwable exception) {
186+
if (exception instanceof AppsmithException appsmithException
187+
&& AppsmithError.GIT_FILE_SYSTEM_ERROR.getAppErrorCode().equals(appsmithException.getAppErrorCode())) {
188+
return Mono.just(ArtifactType.APPLICATION);
189+
}
190+
191+
return Mono.error(exception);
192+
}
193+
185194
public Mono<ArtifactType> obtainArtifactTypeFromGitRepository(ArtifactJsonTransformationDTO jsonTransformationDTO) {
186195
String workspaceId = jsonTransformationDTO.getWorkspaceId();
187196
String placeHolder = jsonTransformationDTO.getBaseArtifactId();
188197
String repoName = jsonTransformationDTO.getRepoName();
189198
Path temporaryStorage = Path.of(workspaceId, placeHolder, repoName);
190199

191-
return commonGitFileUtils.getArtifactJsonTypeOfRepository(temporaryStorage);
200+
return commonGitFileUtils
201+
.getArtifactJsonTypeOfRepository(temporaryStorage)
202+
.onErrorResume(error -> {
203+
return handleErrorWhileArtifactTypeIdentification(error);
204+
});
192205
}
193206

194207
@Override

app/server/appsmith-server/src/main/java/com/appsmith/server/helpers/ce/CommonGitFileUtilsCE.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -867,7 +867,8 @@ public Mono<ArtifactType> getArtifactJsonTypeOfRepository(Path repoSuffix) {
867867
if (metadataJsonObject == null) {
868868
log.error(
869869
"Error in retrieving the metadata from the file system for repository {}", repoSuffix);
870-
return Mono.error(new AppsmithException(AppsmithError.GIT_FILE_SYSTEM_ERROR));
870+
return Mono.error(
871+
new AppsmithException(AppsmithError.NO_RESOURCE_FOUND, CommonConstants.METADATA));
871872
}
872873

873874
JsonElement artifactJsonType = metadataJsonObject.get(ARTIFACT_JSON_TYPE);
@@ -876,7 +877,8 @@ public Mono<ArtifactType> getArtifactJsonTypeOfRepository(Path repoSuffix) {
876877
log.error(
877878
"artifactJsonType attribute not found in the metadata file for repository {}",
878879
repoSuffix);
879-
return Mono.error(new AppsmithException(AppsmithError.GIT_FILE_SYSTEM_ERROR));
880+
return Mono.error(new AppsmithException(
881+
AppsmithError.GIT_FILE_SYSTEM_ERROR, "No artifactJsonType attribute found"));
880882
}
881883

882884
return Mono.just(artifactJsonType.getAsString());

0 commit comments

Comments
 (0)