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

Refactor exceptions to use InvalidCharacterException. #86

Merged
merged 1 commit into from
Jan 2, 2025

Conversation

shinji-san
Copy link
Owner

This pull request introduces a new exception class InvalidCharacterException and updates various methods and tests to use this new exception instead of ArgumentException. Additionally, it includes renaming and refactoring of test methods for clarity.

New Exception Class:

  • Added InvalidCharacterException to handle cases where an input string contains invalid characters. (src/InvalidCharacterException.cs)

Method Updates:

  • Replaced ArgumentException with InvalidCharacterException in the AlphaNumericToNumeric and ValidateAndTrimNumber methods. (src/Luhn.cs) [1] [2] [3] [4]

Test Updates:

  • Updated test methods to use InvalidCharacterException instead of ArgumentException. (tests/LuhnTest.cs) [1] [2] [3]
  • Renamed test methods for better clarity and consistency. (tests/LuhnTest.cs) [1] [2] [3] [4] [5] [6] [7] [8]

Documentation:

  • Updated CHANGELOG.md to include the addition of InvalidCharacterException and the renaming of Luhn.ConvertAlphaNumericToNumeric. (CHANGELOG.md)

@shinji-san shinji-san self-assigned this Jan 1, 2025
Replaced `ArgumentException` with the new `InvalidCharacterException` for better semantic clarity when handling invalid input.
Added `InvalidCharacterException` class and updated related tests accordingly to align with these changes.
Updated the changelog to document the addition.

Resolves: No entry
@shinji-san shinji-san force-pushed the feature-InvalidCharacterException branch from f3e8ac2 to d343f2d Compare January 1, 2025 22:06
@shinji-san shinji-san merged commit c423f11 into develop Jan 2, 2025
3 checks passed
@shinji-san shinji-san deleted the feature-InvalidCharacterException branch January 2, 2025 11:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant