-
-
Notifications
You must be signed in to change notification settings - Fork 276
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2271 from acelaya-forks/feature/api-key-domain-ex…
…ceptions Use more meaningful domain exceptions to represent ApiKeyService thrown errors
- Loading branch information
Showing
5 changed files
with
66 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Shlinkio\Shlink\Rest\Exception; | ||
|
||
use function sprintf; | ||
|
||
class ApiKeyConflictException extends RuntimeException implements ExceptionInterface | ||
{ | ||
public static function forName(string $name): self | ||
{ | ||
return new self(sprintf('An API key with name "%s" already exists', $name)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Shlinkio\Shlink\Rest\Exception; | ||
|
||
use function sprintf; | ||
|
||
class ApiKeyNotFoundException extends RuntimeException implements ExceptionInterface | ||
{ | ||
public static function forName(string $name): self | ||
{ | ||
return new self(sprintf('API key with name "%s" not found', $name)); | ||
} | ||
|
||
/** @deprecated */ | ||
public static function forKey(string $key): self | ||
{ | ||
return new self(sprintf('API key with key "%s" not found', $key)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters