Skip to content

Commit

Permalink
Refactor and Rename handleNoImageFoundException for Clarity
Browse files Browse the repository at this point in the history
- Updated findTagSha to handle String return from handleNoImageFoundException
- Renamed handleNoImageFoundException to generateImageStreamErrorMessage for more accurate and descriptive name
  • Loading branch information
724thomas committed Jan 12, 2024
1 parent 857c9d6 commit 18c329e
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ private String findTagSha(OpenShiftClient client, String imageStreamName, String
}
}
// Handle the case when no image is found after all retries:
throw handleNoImageFoundException(currentImageStream, imageStreamName);
return generateImageStreamErrorMessage(currentImageStream, imageStreamName);
}

// Method to sleep the current thread for a given amount of time
Expand Down Expand Up @@ -242,11 +242,11 @@ private TagEvent updateLatestTagFromList(TagEvent latestTag, NamedTagEventList l
}

// Method to handle cases where no image is found
private IllegalStateException handleNoImageFoundException(ImageStream currentImageStream, String imageStreamName) {
private String generateImageStreamErrorMessage(ImageStream currentImageStream, String imageStreamName) {
if (currentImageStream == null) {
return new IllegalStateException("Could not find ImageStream with name " + imageStreamName + "in namespace " + namespace);
return "Could not find ImageStream with name " + imageStreamName + " in namespace " + namespace;
} else {
return new IllegalStateException("Could not find a tag in the ImageStream " + imageStreamName);
return "Could not find a tag in the ImageStream " + imageStreamName;
}
}

Expand Down

0 comments on commit 18c329e

Please sign in to comment.