diff options
| author | Zeyla Hellyer <[email protected]> | 2017-02-11 21:10:20 -0800 |
|---|---|---|
| committer | Zeyla Hellyer <[email protected]> | 2017-02-11 21:10:20 -0800 |
| commit | 7e254c5c6098bb1a47bac26c9895098a46cdc53f (patch) | |
| tree | d8adb2ff9d709ae32f12286f1432996011367cbf /src/client/error.rs | |
| parent | Update voice example to latest changes (diff) | |
| download | serenity-7e254c5c6098bb1a47bac26c9895098a46cdc53f.tar.xz serenity-7e254c5c6098bb1a47bac26c9895098a46cdc53f.zip | |
Handle unsuccessful responses before decoding
Instead of assuming every request is successful, check that the class of
the status is successful (2xx), and if not, return a
`ClientError::InvalidRequest`, which is a renamed
`ClientError::UnexpectedStatusCode`.
Diffstat (limited to 'src/client/error.rs')
| -rw-r--r-- | src/client/error.rs | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/client/error.rs b/src/client/error.rs index 8a92cdd..1eaa2c6 100644 --- a/src/client/error.rs +++ b/src/client/error.rs @@ -142,7 +142,7 @@ pub enum Error { /// [`Context::edit_channel`]: struct.Context.html#method.edit_channel UnexpectedChannelType(ChannelType), /// When a status code was unexpectedly received for a request's status. - UnexpectedStatusCode(StatusCode), + InvalidRequest(StatusCode), /// When a status is received, but the verification to ensure the response /// is valid does not recognize the status. UnknownStatus(u16), |