Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -182,13 +182,26 @@ public Mono<Tuple2<ArtifactType, String>> obtainArtifactTypeAndIdentifierFromGit
return obtainArtifactTypeFromGitRepository(jsonTransformationDTO).zipWith(Mono.just(""));
}

protected Mono<ArtifactType> handleErrorWhileArtifactTypeIdentification(Throwable exception) {
if (exception instanceof AppsmithException appsmithException
&& AppsmithError.GIT_FILE_SYSTEM_ERROR.getAppErrorCode().equals(appsmithException.getAppErrorCode())) {
return Mono.just(ArtifactType.APPLICATION);
}

return Mono.error(exception);
}

public Mono<ArtifactType> obtainArtifactTypeFromGitRepository(ArtifactJsonTransformationDTO jsonTransformationDTO) {
String workspaceId = jsonTransformationDTO.getWorkspaceId();
String placeHolder = jsonTransformationDTO.getBaseArtifactId();
String repoName = jsonTransformationDTO.getRepoName();
Path temporaryStorage = Path.of(workspaceId, placeHolder, repoName);

return commonGitFileUtils.getArtifactJsonTypeOfRepository(temporaryStorage);
return commonGitFileUtils
.getArtifactJsonTypeOfRepository(temporaryStorage)
.onErrorResume(error -> {
return handleErrorWhileArtifactTypeIdentification(error);
});
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -867,7 +867,8 @@ public Mono<ArtifactType> getArtifactJsonTypeOfRepository(Path repoSuffix) {
if (metadataJsonObject == null) {
log.error(
"Error in retrieving the metadata from the file system for repository {}", repoSuffix);
return Mono.error(new AppsmithException(AppsmithError.GIT_FILE_SYSTEM_ERROR));
return Mono.error(
new AppsmithException(AppsmithError.NO_RESOURCE_FOUND, CommonConstants.METADATA));
}

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

return Mono.just(artifactJsonType.getAsString());
Expand Down
Loading