# TryYourSizeException

> Every error the SDK raises: a stable code, a message and a doc link (like the web SDK).

Source: https://docs.tryyoursize.com/reference/android/errors/

*Type* · `com.tryyoursize:tryyoursize-android`

Every error the SDK raises: a stable `code`, a message and a doc link (like the web SDK).

Each error has a `code` (its `wire` value is the documented code), a message and a `docUrl`. Explanations: [Mobile SDK errors](https://docs.tryyoursize.com/mobile/errors.md).

## Codes

- **`SECRET_KEY_IN_APP`** (`"secret_key_in_app"`, optional): A secret (`sk_`) or restricted (`rk_`) key was passed. Those belong on your server.
- **`INVALID_KEY`** (`"invalid_key"`, optional): Not a publishable key (`pk_test_…` / `pk_live_…`).
- **`INVALID_APP_IDENTIFIER`** (`"invalid_app_identifier"`, optional): The package name can't be used as an app origin.
- **`INVALID_OPTION`** (`"invalid_option"`, optional)
- **`WINDOW_UNREACHABLE`** (`"window_unreachable"`, optional): Our window did not answer (offline, or blocked).
- **`APP_NOT_ALLOWED`** (`"app_not_allowed"`, optional): This app (`android-app://<package>`) is not registered for the key's store.
- **`SIGN_IN_CANCELLED`** (`"sign_in_cancelled"`, optional)
- **`SIGN_IN_UNAVAILABLE`** (`"sign_in_unavailable"`, optional): System-browser sign-in is not available yet.

## Example

**Kotlin**

```kotlin
try {
    tys = TryYourSize(context, key)
} catch (e: TryYourSizeException) {
    if (e.code == TryYourSizeException.Code.SECRET_KEY_IN_APP) error("Use the pk_ key")
}
```
