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 authored and manusa committed Jan 23, 2024
1 parent 1807916 commit be0ce2e
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ private String findTagSha(OpenShiftClient client, String imageStreamName, String
}
}
// Handle the case when no image is found after all retries:
throw handleNoImageFoundException(currentImageStream, imageStreamName);
throw new IllegalStateException(generateImageStreamErrorMessage(currentImageStream, imageStreamName));
}

// Method to sleep the current thread for a given amount of time
Expand Down Expand Up @@ -250,11 +250,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 a current ImageStream with name " + imageStreamName + " in namespace " + namespace);
return "Could not find a current 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 be0ce2e

Please sign in to comment.