Skip to content

Conversation

@hsaito
Copy link
Owner

@hsaito hsaito commented Aug 25, 2025

This pull request updates the "My Number" validation library and CLI tool to improve input validation, error handling, and logging, as well as modernize project dependencies. The changes add robust checks for malformed input, enhance CLI user feedback, switch logging to NLog with improved configuration, and upgrade all projects to .NET 8.0 for better compatibility and maintainability.

Input validation and error handling:

  • Added null checks and digit range validation to VerifyNumber, CalculateCheckDigits, and Truncate methods in MyNumber.cs, throwing MyNumberMalformedException for invalid input. Exception classes are now public for broader use. [1] [2] [3] [4]
  • CLI commands now catch and log exceptions, providing user-friendly error messages for malformed or invalid input in generate, check, complete, and range operations. [1] [2]

Logging improvements:

  • Switched CLI logging from log4net to NLog, updated configuration to include exception details in log output, and set log level to Debug for more detailed logs. [1] [2]
  • Enhanced CLI logging with informative messages for command execution, argument validation, and error cases.

Project modernization:

  • Upgraded target frameworks for all projects (MyNumberNET, MyNumberNET_CLI, MyNumberNET_Test) to .NET 8.0 for improved performance and compatibility. [1] [2] [3]
  • Updated random number generation to correctly include all digits 0–9.

@hsaito hsaito self-assigned this Aug 25, 2025
@hsaito hsaito merged commit 1428b35 into master Aug 25, 2025
5 of 6 checks passed
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.

2 participants