Skip to content

Release v1.0.0: Initial release with README additions and exception handling component #1

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

Merged
merged 7 commits into from
Oct 16, 2024

Conversation

walmir-silva
Copy link
Contributor

This release introduces the initial version (v1.0.0) of the KaririCode Exception Component with the following features:

  • Comprehensive exception handling structure
  • README.md (English version) with usage instructions and documentation
  • README.pt-br.md (Portuguese version) with equivalent documentation
  • Error code range table for better error categorization
  • Examples of basic and advanced usage
  • Integration with other KaririCode components

This marks the first official release of the Exception Component.
This release introduces the initial version (v1.0.0) of the KaririCode Exception Component with the following features:

  • Comprehensive exception handling structure
  • README.md (English version) with usage instructions and documentation
  • README.pt-br.md (Portuguese version) with equivalent documentation
  • Error code range table for better error categorization
  • Examples of basic and advanced usage
  • Integration with other KaririCode components

Beta
Give feedback
growthcodeoficial
growthcodeoficial
committed
Oct 13, 2024
·
·
- Added base folder structure
- Configured Composer with dependencies and autoload settings
- Included development tools: PHPUnit, PHPStan, PHP CS Fixer, and PHP CodeSniffer
- Added Docker setup with docker-compose.yml
- Provided example environment configuration (.env.example)
- Created `AbstractException` as the base exception class
- Added `AuthenticationException` and `AuthorizationException` under `Auth`
- Added `CacheException` under `Cache`
- Added `ConfigurationException` under `Config`
- Added `ContainerException` under `Container`
- Added `DatabaseException` under `Database`
- Added `EventException` under `Event`
- Added `ExternalServiceException` under `ExternalService`
- Added `FileException` under `File`
- Added `InputException` under `Input`
- Added `LocalizationException` under `Localization`
- Added `MiddlewareException` under `Middleware`
- Added `NetworkException` and `HttpException` under `Network`
- Added `QueueException` under `Queue`
- Added `RoutingException` under `Routing`
- Added `RuntimeException` under `Runtime`
- Added `SecurityException` and `EncryptionException` under `Security`
- Added `SessionException` under `Session`
- Added `SystemException` under `System`
- Added `TemplateException` under `Template`
- Added `ValidationException` and `RuleViolationException` under `Validation`
- Added PHPUnit test classes for each exception class under `tests` directory
- Created directory structure mirroring the source code for proper organization of tests
- **Added numeric error code constants** to all exception classes in `src/` directory.
  - Each exception class now defines private constants for error codes.
  - Factory methods updated to use these constants when creating `ExceptionMessage` instances.
- **Modified `ExceptionMessage` class** to accept `int $code` as the first parameter.
  - Updated constructor signature to `public function __construct(int $code, string $errorCode, string $message)`.
  - Ensured compatibility across all usages.
- **Updated `AbstractException` class**:
  - Constructor now sets the numeric code from `ExceptionMessage` using `$errorMessage->getCode()`.
  - Maintains error code string and context.
- **Refactored exception tests in `tests/` directory**:
  - Updated `assertExceptionStructure` method in `AbstractExceptionTest` to include assertion for numeric error code.
  - All exception test classes now pass the expected numeric code to `assertExceptionStructure`.
  - Ensured that all tests reflect the changes in the exception classes and pass successfully.
- **Consistent Error Code Ranges**:
  - Established a consistent error code range for each exception type as per the error code range table.
  - This enhances error categorization and future maintainability.

**Summary:**

This commit refactors the exception handling mechanism by introducing numeric error code constants across all exception classes and their corresponding tests. This change enhances the clarity and maintainability of the codebase by:

- Providing a standardized way to identify exceptions through numeric codes.
- Improving error categorization according to the defined error code ranges.
- Ensuring consistency between the exception classes and their tests.
- Facilitating better integration with logging and error handling systems that utilize numeric error codes.
…component

- Added README.md (English version) with detailed instructions for using the Exception component
- Added README.pt-br.md (Portuguese version) with equivalent content for Brazilian developers
@walmir-silva walmir-silva merged commit 1c562fb into main Oct 16, 2024
1 check 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.

1 participant