Skip to content

Commit

Permalink
Merge pull request #4 from andgar2010/feature/1.0.0
Browse files Browse the repository at this point in the history
Introduce Dedicated HTTP 4xx & 5xx Exception Classes, Streamline Testing & Workflow
  • Loading branch information
tech-andgar committed Feb 26, 2024
2 parents c8f508b + 1753225 commit a82031a
Show file tree
Hide file tree
Showing 18 changed files with 9,277 additions and 284 deletions.
14 changes: 7 additions & 7 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-latest] # or: macos-latest, windows-latest
channel: ['2.15.0', stable, beta, dev, main] # or: 'beta', 'dev' or 'main'
channel: ['2.18.0', stable, beta, dev, main] # or: 'beta', 'dev' or 'main'

steps:
- uses: actions/checkout@v4
Expand Down Expand Up @@ -46,14 +46,14 @@ jobs:
dart pub global activate coverage
dart pub global run coverage:test_with_coverage
# - name: Check Code Coverage
# uses: VeryGoodOpenSource/very_good_coverage@v2
# with:
# path: "./coverage/lcov.info"
# min_coverage: 100
- name: Check Code Coverage
uses: VeryGoodOpenSource/very_good_coverage@v2
with:
path: "./coverage/lcov.info"
min_coverage: 89

- name: Coveralls GitHub Action
uses: coverallsapp/github-action@v2.2.3
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
path-to-lcov: coverage/lcov.info
path-to-lcov: coverage/lcov.info
72 changes: 68 additions & 4 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,79 @@
# Changelog

## 1.0.0

- **HTTP Exception Handling:**
- Replaced `HttpStatus` with `HttpStatusCode` for consistency and potential benefits (explore further).
- Improved readability of exception classes for better maintainability.
- Enhanced exception handling mechanisms for more robust error management.
- Added dedicated classes for HTTP 4xx and 5xx exceptions to categorize errors effectively.
- Introduced constructors for 4xx and 5xx exceptions to streamline exception creation.
- **Code Organization and Linting:**
- Refactored HTTP exception code into multiple files for better modularity and organization.
- Enhanced Dart code linting to enforce coding standards and maintain code quality.

| Code | Http Status (v0.2.2 - v1.x.x [Deprecated]) | HttpException (v1.x.x) |
| ---- | ------------------------------------------ | ---------------------------------------------- |
| 400 | BadRequestException() | BadRequestHttpException() |
| 401 | UnauthorizedException() | UnauthorizedHttpException() |
| 402 | PaymentRequiredException() | PaymentRequiredHttpException() |
| 403 | ForbiddenException() | ForbiddenHttpException() |
| 404 | NotFoundException() | NotFoundHttpException() |
| 405 | MethodNotAllowedException() | MethodNotAllowedHttpException() |
| 406 | NotAcceptableException() | NotAcceptableHttpException() |
| 407 | - | ProxyAuthenticationRequiredHttpException() |
| 408 | - | RequestTimeoutHttpException() |
| 409 | ConflictException() | ConflictHttpException() |
| 410 | GoneException() | GoneHttpException() |
| 411 | - | LengthRequiredHttpException() |
| 412 | PreconditionFailedException() | PreconditionFailedHttpException() |
| 413 | - | RequestTooLongHttpException() |
| 414 | - | RequestUriTooLongHttpException() |
| 415 | UnsupportedMediaTypeException() | UnsupportedMediaTypeHttpException() |
| 416 | - | RequestedRangeNotSatisfiableHttpException() |
| 417 | - | ExpectationFailedHttpException() |
| 418 | - | ImATeapotHttpException() |
| 419 | - | InsufficientSpaceOnResourceHttpException() |
| 420 | - | MethodFailureHttpException() |
| 421 | - | MisdirectedRequestHttpException() |
| 422 | - | UnprocessableEntityHttpException() |
| 423 | - | LockedHttpException() |
| 424 | - | FailedDependencyHttpException() |
| 426 | - | UpgradeRequiredHttpException() |
| 428 | - | PreconditionRequiredHttpException() |
| 429 | TooManyRequestsException() | TooManyRequestsHttpException() |
| 431 | - | RequestHeaderFieldsTooLargeHttpException() |
| 444 | - | ConnectionClosedWithoutResponseHttpException() |
| 451 | - | UnavailableForLegalReasonsHttpException() |
| 499 | - | ClientClosedRequestHttpException() |
| 500 | - | InternalServerErrorHttpException() |
| 501 | NotImplementedException() | NotImplementedHttpException() |
| 502 | - | BadGatewayHttpException() |
| 503 | ServiceUnavailableException() | ServiceUnavailableHttpException() |
| 504 | - | GatewayTimeoutHttpException() |
| 505 | - | HttpVersionNotSupportedHttpException() |
| 506 | - | VariantAlsoNegotiatesHttpException() |
| 507 | - | InsufficientStorageHttpException() |
| 508 | - | LoopDetectedHttpException() |
| 510 | - | NotExtendedHttpException() |
| 511 | - | NetworkAuthenticationRequiredHttpException() |
| 599 | - | NetworkConnectTimeoutErrorHttpException() |

## 0.2.2

- dart migrate for null-safety

## 0.2.1

- `toMap()` should not throw when `data` is `null`

## 0.2.0

- migrate to Dart 2
- enable Travis CI
- add badges


## 0.1.0

- created this package consisting only of the exception classes from the
shelf_exception_response package.

## 0.2.0
- Dart 2 support
3 changes: 3 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
Copyright (c) 2014, Thomas Profelt
Copyright (c) 2015, Günter Zöchbauer, Thomas Profelt
Copyright (c) 2021, Diego Perez.
Copyright (c) 2024, Andres Garcia (TECH-ANDGAR).

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down

0 comments on commit a82031a

Please sign in to comment.