Skip to content

Commit

Permalink
string interpolation
Browse files Browse the repository at this point in the history
  • Loading branch information
Inderpal Singh committed Mar 21, 2024
1 parent b45ce65 commit 655aef3
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@
package io.github.genomicdatainfrastructure.daam.exceptions;

public class ApplicationNotFoundException extends RuntimeException {

private static final String MESSAGE = "Application %s not found";
public ApplicationNotFoundException(Long applicationId) {
super("Application " + applicationId + " not found");
super(MESSAGE.formatted(applicationId));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@
package io.github.genomicdatainfrastructure.daam.exceptions;

public class ApplicationNotInCorrectStateException extends RuntimeException {

private static final String MESSAGE = "Application %s is not in correct state: %s";
public ApplicationNotInCorrectStateException(Long id, String state) {
super("Application " + id + " is not in correct state: " + state);
super(MESSAGE.formatted(id, state));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@
package io.github.genomicdatainfrastructure.daam.exceptions;

public class UserNotApplicantException extends RuntimeException {

private static final String MESSAGE = "User %s is not an applicant for application %s";
public UserNotApplicantException(Long applicationId, String userId) {
super("User " + userId + " is not an applicant for application " + applicationId);
super(MESSAGE.formatted(userId, applicationId));
}
}

0 comments on commit 655aef3

Please sign in to comment.