Added logic to properly map all existing errors from v3 to v2 in the API

This commit is contained in:
Alejandro Celaya
2022-08-13 17:15:04 +02:00
parent cd4fe4362b
commit 905f51fbd0
24 changed files with 51 additions and 30 deletions

View File

@@ -12,13 +12,15 @@ class VerifyAuthenticationException extends RuntimeException implements ProblemD
{
use CommonProblemDetailsExceptionTrait;
public const TYPE = 'https://shlink.io/api/error/invalid-api-key';
public static function forInvalidApiKey(): self
{
$e = new self('Provided API key does not exist or is invalid.');
$e->detail = $e->getMessage();
$e->title = 'Invalid API key';
$e->type = 'INVALID_API_KEY';
$e->type = self::TYPE;
$e->status = StatusCodeInterface::STATUS_UNAUTHORIZED;
return $e;