mirror of
https://github.com/shlinkio/shlink.git
synced 2026-03-10 17:23:12 +08:00
Added logic to properly map all existing errors from v3 to v2 in the API
This commit is contained in:
@@ -16,7 +16,7 @@ class DeleteShortUrlException extends DomainException implements ProblemDetailsE
|
||||
use CommonProblemDetailsExceptionTrait;
|
||||
|
||||
private const TITLE = 'Cannot delete short URL';
|
||||
private const TYPE = 'INVALID_SHORT_URL_DELETION';
|
||||
public const TYPE = 'https://shlink.io/api/error/invalid-short-url-deletion';
|
||||
|
||||
public static function fromVisitsThreshold(int $threshold, ShortUrlIdentifier $identifier): self
|
||||
{
|
||||
|
||||
@@ -15,7 +15,7 @@ class DomainNotFoundException extends DomainException implements ProblemDetailsE
|
||||
use CommonProblemDetailsExceptionTrait;
|
||||
|
||||
private const TITLE = 'Domain not found';
|
||||
private const TYPE = 'DOMAIN_NOT_FOUND';
|
||||
public const TYPE = 'https://shlink.io/api/error/domain-not-found';
|
||||
|
||||
private function __construct(string $message, array $additional)
|
||||
{
|
||||
|
||||
@@ -13,7 +13,7 @@ class ForbiddenTagOperationException extends DomainException implements ProblemD
|
||||
use CommonProblemDetailsExceptionTrait;
|
||||
|
||||
private const TITLE = 'Forbidden tag operation';
|
||||
private const TYPE = 'FORBIDDEN_OPERATION';
|
||||
public const TYPE = 'https://shlink.io/api/error/forbidden-tag-operation';
|
||||
|
||||
public static function forDeletion(): self
|
||||
{
|
||||
|
||||
@@ -16,7 +16,7 @@ class InvalidUrlException extends DomainException implements ProblemDetailsExcep
|
||||
use CommonProblemDetailsExceptionTrait;
|
||||
|
||||
private const TITLE = 'Invalid URL';
|
||||
private const TYPE = 'INVALID_URL';
|
||||
public const TYPE = 'https://shlink.io/api/error/invalid-url';
|
||||
|
||||
public static function fromUrl(string $url, ?Throwable $previous = null): self
|
||||
{
|
||||
|
||||
@@ -16,7 +16,7 @@ class NonUniqueSlugException extends InvalidArgumentException implements Problem
|
||||
use CommonProblemDetailsExceptionTrait;
|
||||
|
||||
private const TITLE = 'Invalid custom slug';
|
||||
private const TYPE = 'INVALID_SLUG';
|
||||
public const TYPE = 'https://shlink.io/api/error/non-unique-slug';
|
||||
|
||||
public static function fromSlug(string $slug, ?string $domain = null): self
|
||||
{
|
||||
|
||||
@@ -16,7 +16,7 @@ class ShortUrlNotFoundException extends DomainException implements ProblemDetail
|
||||
use CommonProblemDetailsExceptionTrait;
|
||||
|
||||
private const TITLE = 'Short URL not found';
|
||||
private const TYPE = 'INVALID_SHORTCODE';
|
||||
public const TYPE = 'https://shlink.io/api/error/short-url-not-found';
|
||||
|
||||
public static function fromNotFound(ShortUrlIdentifier $identifier): self
|
||||
{
|
||||
|
||||
@@ -16,7 +16,7 @@ class TagConflictException extends RuntimeException implements ProblemDetailsExc
|
||||
use CommonProblemDetailsExceptionTrait;
|
||||
|
||||
private const TITLE = 'Tag conflict';
|
||||
private const TYPE = 'TAG_CONFLICT';
|
||||
public const TYPE = 'https://shlink.io/api/error/tag-conflict';
|
||||
|
||||
public static function forExistingTag(TagRenaming $renaming): self
|
||||
{
|
||||
|
||||
@@ -15,7 +15,7 @@ class TagNotFoundException extends DomainException implements ProblemDetailsExce
|
||||
use CommonProblemDetailsExceptionTrait;
|
||||
|
||||
private const TITLE = 'Tag not found';
|
||||
private const TYPE = 'TAG_NOT_FOUND';
|
||||
public const TYPE = 'https://shlink.io/api/error/tag-not-found';
|
||||
|
||||
public static function fromTag(string $tag): self
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user