# Exceptions

## Exceptions

All exceptions SDK can throw extends **unified.vpn.sdk.VpnException**

There are couple of main derivatives of this exception:

**PartnerApiException** - Thrown in case of server API errors

**getCode** - HTTP error code

**getContent** - response content

Possible values for **getContent**:

* `CODE_NOT_AUTHORIZED` - user is not authorized. Need to call HydraSdk.login
* `CODE_SESSIONS_EXCEED` - session limit is reached in accordance with the ToS
* `CODE_DEVICES_EXCEED` - device limit is reached in accordance with the ToS
* `CODE_OAUTH_ERROR` - returns in all cases when an authentication error occurred on OAuth server
* `CODE_TRAFFIC_EXCEED` - reached active traffic limitation in accordance with the ToS
* `CODE_SERVER_UNAVAILABLE` - server temporarily unavailable or server not found
* `CODE_INTERNAL_SERVER_ERROR` - internal server error
* `USER_SUSPENDED` - user suspended
* `CODE_PARSE_EXCEPTION` - failed to parse server response

#### **VpnTransportException**

Thrown when error happens in VPN transport

**getCode** - code of error

* `HydraVpnTransportException` - is thrown by **Hydra** transport
* `OpenVpnTransportException` - is thrown by **OpenVPN** transport

Possible values for **getCode** on **Hydra** transport

* `HydraVpnTransportException.HYDRA_ERROR_BROKEN` - VPN connection broken
* `HydraVpnTransportException.HYDRA_ERROR_CONNECT` - Hydra fails to connect to server
* `HydraVpnTransportException.HYDRA_DCN_BLOCKED_BW` - Hydra server reported traffic exceedance, connection interrupted
* `HydraVpnTransportException.HYDRA_DCN_BLOCKED_AUTH` - Hydra server reported auth failure

Possible values for **getCode** on **OpenVPN** transport

* `OpenVpnTransportException.CONNECTION_BROKEN_ERROR` - server interrupted connection
* `OpenVpnTransportException.CONNECTION_FAILED_ERROR` - failed to connect to server
* `OpenVpnTransportException.CONNECTION_AUTH_FAILURE` - server reported auth failure

#### **NetworkRelatedException**

Thrown in case of server connection problems

#### **WrongStateException**

Thrown when calling `start` or `stop` in wrong SDK state

#### **InternalException**

Thrown for any other unexpected cases. In **getCause** you can get original source exception

#### **CnlBlockedException**

Thrown when connecting to network that has **Disabled** state in CNL config.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://pango.gitbook.io/paas/sdk/vpn-sdk-for-android/exceptions.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
