Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: migrate preconditions to use non-null error messages #381

Open
1 task
Tracked by #309
ata-nas opened this issue Dec 5, 2024 · 0 comments
Open
1 task
Tracked by #309

chore: migrate preconditions to use non-null error messages #381

ata-nas opened this issue Dec 5, 2024 · 0 comments
Labels
Block Node Issues/PR related to the Block Node. Improvement Code changes driven by non business requirements P2 Required to be completed in the assigned milestone, but may or may not impact release schedule.
Milestone

Comments

@ata-nas
Copy link
Contributor

ata-nas commented Dec 5, 2024

Description

Based on this comment, lets improve the Preconditions API.

e.g.

    public static int requirePositive(final int valueToCheck) {
        return requirePositive(valueToCheck,
                "The input integer [%d] is required be positive."
                .formatted(valueToCheck));

    }
    public static int requirePositive(final int valueToCheck, @NonNull final String errorMessage) {
        if (0 >= valueToCheck) {
            throw new IllegalArgumentException(message);
        } else {
            return valueToCheck;
        }
    }

What needs to be done

  • migrate all Preconditions to not accept a null message as suggested here
@ata-nas ata-nas self-assigned this Dec 5, 2024
@ata-nas ata-nas added Improvement Code changes driven by non business requirements P2 Required to be completed in the assigned milestone, but may or may not impact release schedule. Block Node Issues/PR related to the Block Node. labels Dec 5, 2024
@ata-nas ata-nas removed their assignment Dec 5, 2024
@ata-nas ata-nas added this to the 0.3.0 milestone Dec 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Block Node Issues/PR related to the Block Node. Improvement Code changes driven by non business requirements P2 Required to be completed in the assigned milestone, but may or may not impact release schedule.
Projects
None yet
Development

No branches or pull requests

1 participant