diff options
| author | David Lönnhager <david.l@mullvad.net> | 2022-05-11 16:18:10 +0200 |
|---|---|---|
| committer | David Lönnhager <david.l@mullvad.net> | 2022-05-11 17:37:43 +0200 |
| commit | d593dce00a0872a4e51bd95f193e667fa24b0810 (patch) | |
| tree | f62bb05709d60d4aaf76f01daf8ec0f74b45e0d4 /mullvad-api/src | |
| parent | b47084be5bf38713d4016e138f5c513343c25d63 (diff) | |
| download | mullvadvpn-d593dce00a0872a4e51bd95f193e667fa24b0810.tar.xz mullvadvpn-d593dce00a0872a4e51bd95f193e667fa24b0810.zip | |
Check status in API response body to determine whether a device has been revoked
Diffstat (limited to 'mullvad-api/src')
| -rw-r--r-- | mullvad-api/src/lib.rs | 3 | ||||
| -rw-r--r-- | mullvad-api/src/rest.rs | 1 |
2 files changed, 3 insertions, 1 deletions
diff --git a/mullvad-api/src/lib.rs b/mullvad-api/src/lib.rs index 9c23fea6a7..714718814b 100644 --- a/mullvad-api/src/lib.rs +++ b/mullvad-api/src/lib.rs @@ -47,6 +47,9 @@ pub const INVALID_VOUCHER: &str = "INVALID_VOUCHER"; /// Error code returned by the Mullvad API if the account token is invalid. pub const INVALID_ACCOUNT: &str = "INVALID_ACCOUNT"; +/// Error code returned by the Mullvad API if the device does not exist. +pub const DEVICE_NOT_FOUND: &str = "DEVICE_NOT_FOUND"; + /// Error code returned by the Mullvad API if the access token is invalid. pub const INVALID_ACCESS_TOKEN: &str = "INVALID_ACCESS_TOKEN"; diff --git a/mullvad-api/src/rest.rs b/mullvad-api/src/rest.rs index 517e0b3a03..d174c3d19c 100644 --- a/mullvad-api/src/rest.rs +++ b/mullvad-api/src/rest.rs @@ -584,7 +584,6 @@ pub async fn parse_rest_response( pub async fn handle_error_response<T>(response: Response) -> Result<T> { let status = response.status(); let error_message = match status { - hyper::StatusCode::NOT_FOUND => "Not found", hyper::StatusCode::METHOD_NOT_ALLOWED => "Method not allowed", status => match get_body_length(&response) { 0 => status.canonical_reason().unwrap_or("Unexpected error"), |
