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

Add ForbiddenException #250

Merged
merged 2 commits into from
Jul 15, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@
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 @@
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
{
}