Skip to content

Commit

Permalink
Add ForbiddenException
Browse files Browse the repository at this point in the history
  • Loading branch information
tomasDostalDS committed Jul 15, 2024
1 parent 821778d commit 4271cde
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ All notable changes will be documented in this file.
Updates should follow the [Keep a CHANGELOG](http://keepachangelog.com/) principles.

## [Unreleased]
- Add `ForbiddenException`
- Add `AccountBilling.productType`
- Add `EnvelopesEndpoint.cancel` body
- Fix `AccountUsersEndpoint.invite` endpoint
Expand Down
4 changes: 4 additions & 0 deletions src/DigiSignClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
use DateTimeInterface;
use DigitalCz\DigiSign\Exception\BadRequestException;
use DigitalCz\DigiSign\Exception\ClientException;
use DigitalCz\DigiSign\Exception\ForbiddenException;
use DigitalCz\DigiSign\Exception\NotFoundException;
use DigitalCz\DigiSign\Exception\RuntimeException;
use DigitalCz\DigiSign\Exception\ServerException;
Expand Down Expand Up @@ -34,6 +35,7 @@ final class DigiSignClient implements DigiSignClientInterface
public const HTTP_NO_CONTENT = 204;
public const HTTP_BAD_REQUEST = 400;
public const HTTP_UNAUTHORIZED = 401;
public const HTTP_FORBIDDEN = 403;
public const HTTP_NOT_FOUND = 404;
public const HTTP_INTERNAL_SERVER_ERROR = 500;

Expand Down Expand Up @@ -288,6 +290,8 @@ private function checkResponse(ResponseInterface $response): void
throw new UnauthorizedException($response);
case self::HTTP_NOT_FOUND:
throw new NotFoundException($response);
case self::HTTP_FORBIDDEN:
throw new ForbiddenException($response);

Check warning on line 294 in src/DigiSignClient.php

View check run for this annotation

Codecov / codecov/patch

src/DigiSignClient.php#L293-L294

Added lines #L293 - L294 were not covered by tests
default:
throw new ClientException($response);
}
Expand Down
12 changes: 12 additions & 0 deletions src/Exception/ForbiddenException.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?php

declare(strict_types=1);

namespace DigitalCz\DigiSign\Exception;

/**
* Represents response with http status 403
*/
final class ForbiddenException extends ClientException
{
}

0 comments on commit 4271cde

Please sign in to comment.