-
Notifications
You must be signed in to change notification settings - Fork 9
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 #23 from discord-php/improve-exceptions
improve exception classes
- Loading branch information
Showing
8 changed files
with
86 additions
and
12 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,22 @@ | ||
<?php | ||
|
||
/* | ||
* This file is a part of the DiscordPHP-Http project. | ||
* | ||
* Copyright (c) 2021-present David Cole <david.cole1340@gmail.com> | ||
* | ||
* This file is subject to the MIT license that is bundled | ||
* with this source code in the LICENSE file. | ||
*/ | ||
|
||
namespace Discord\Http\Exceptions; | ||
|
||
/** | ||
* Thrown when a request to Discord's REST API returned ClientErrorResponse. | ||
* | ||
* @author SQKo | ||
*/ | ||
class BadRequestException extends RequestFailedException | ||
{ | ||
protected $code = 400; | ||
} |
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 |
---|---|---|
|
@@ -18,4 +18,5 @@ | |
*/ | ||
class InvalidTokenException extends RequestFailedException | ||
{ | ||
protected $code = 401; | ||
} |
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,22 @@ | ||
<?php | ||
|
||
/* | ||
* This file is a part of the DiscordPHP-Http project. | ||
* | ||
* Copyright (c) 2021-present David Cole <david.cole1340@gmail.com> | ||
* | ||
* This file is subject to the MIT license that is bundled | ||
* with this source code in the LICENSE file. | ||
*/ | ||
|
||
namespace Discord\Http\Exceptions; | ||
|
||
/** | ||
* Thrown when a request to Discord's REST API method is invalid. | ||
* | ||
* @author SQKo | ||
*/ | ||
class MethodNotAllowedException extends RequestFailedException | ||
{ | ||
protected $code = 405; | ||
} |
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 |
---|---|---|
|
@@ -18,4 +18,5 @@ | |
*/ | ||
class NoPermissionsException extends RequestFailedException | ||
{ | ||
protected $code = 403; | ||
} |
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 |
---|---|---|
|
@@ -18,4 +18,5 @@ | |
*/ | ||
class NotFoundException extends RequestFailedException | ||
{ | ||
protected $code = 404; | ||
} |
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,23 @@ | ||
<?php | ||
|
||
/* | ||
* This file is a part of the DiscordPHP-Http project. | ||
* | ||
* Copyright (c) 2021-present David Cole <david.cole1340@gmail.com> | ||
* | ||
* This file is subject to the MIT license that is bundled | ||
* with this source code in the LICENSE file. | ||
*/ | ||
|
||
namespace Discord\Http\Exceptions; | ||
|
||
/** | ||
* Thrown when a request to Discord's REST API got rate limited and the library | ||
* does not know how to handle. | ||
* | ||
* @author SQKo | ||
*/ | ||
class RateLimitException extends RequestFailedException | ||
{ | ||
protected $code = 429; | ||
} |
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