# WatchFacePushManager.AddWatchFaceException

Artifact: [androidx.wear.watchfacepush:watchfacepush](https://developer.android.com/jetpack/androidx/releases/wear-watchfacepush) [View Source](https://cs.android.com/search?q=file:androidx/wear/watchfacepush/WatchFacePush.kt+class:androidx.wear.watchfacepush.WatchFacePushManager.AddWatchFaceException) Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/wear-watchfacepush#1.0.0)

*** ** * ** ***

<br />

```
class WatchFacePushManager.AddWatchFaceException : Exception
```

<br />

|---|---|---|---|
| [kotlin.Any](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html) ||||
| ↳ | [kotlin.Throwable](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-throwable/index.html) |||
|   | ↳ | [java.lang.Exception](https://developer.android.com/reference/java/lang/Exception.html) ||
|   |   | ↳ | [androidx.wear.watchfacepush.WatchFacePushManager.AddWatchFaceException](https://developer.android.com/reference/kotlin/androidx/wear/watchfacepush/WatchFacePushManager.AddWatchFaceException) |

*** ** * ** ***

An exception that can be thrown by `https://developer.android.com/reference/kotlin/androidx/wear/watchfacepush/WatchFacePushManager#addWatchFace(android.os.ParcelFileDescriptor,kotlin.String)`

## Summary

| ### Constants |
|---|---|
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/wear/watchfacepush/WatchFacePushManager.AddWatchFaceException#ERROR_INVALID_PACKAGE_NAME()` The package name of the watch face is invalid. |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/wear/watchfacepush/WatchFacePushManager.AddWatchFaceException#ERROR_INVALID_VALIDATION_TOKEN()` The validation token provided does not match the watch face. |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/wear/watchfacepush/WatchFacePushManager.AddWatchFaceException#ERROR_MALFORMED_WATCHFACE_APK()` The provided watch face is not a valid Android APK. |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/wear/watchfacepush/WatchFacePushManager.AddWatchFaceException#ERROR_SLOT_LIMIT_REACHED()` The limit of watch faces that can be installed by this application has been reached. |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/wear/watchfacepush/WatchFacePushManager.AddWatchFaceException#ERROR_UNEXPECTED_CONTENT()` Unexpected content in the APK. |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/wear/watchfacepush/WatchFacePushManager.AddWatchFaceException#ERROR_UNKNOWN()` Unknown error while adding a watch face. |

| ### Public constructors |
|---|
| `https://developer.android.com/reference/kotlin/androidx/wear/watchfacepush/WatchFacePushManager.AddWatchFaceException#AddWatchFaceException(kotlin.Int,kotlin.Throwable)(errorCode: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, rootCause: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-throwable/index.html)` |

| ### Public properties |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/wear/watchfacepush/WatchFacePushManager.AddWatchFaceException#errorCode()` The specific subtype of error occurred. |
| `open https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html?` | `https://developer.android.com/reference/kotlin/androidx/wear/watchfacepush/WatchFacePushManager.AddWatchFaceException#message()` |

### Inherited functions

From [kotlin.Throwable](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-throwable/index.html) `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-throwable/add-suppressed.html(exception: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-throwable/index.html)` `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-throwable/index.html` `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-throwable/fill-in-stack-trace.html()` `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-throwable/index.html` `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-throwable/init-cause.html(cause: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-throwable/index.html)` `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-throwable/print-stack-trace.html()` `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-throwable/print-stack-trace.html(s: https://developer.android.com/reference/java/io/PrintStream.html)` `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-throwable/print-stack-trace.html(s: https://developer.android.com/reference/java/io/PrintWriter.html)`

### Inherited properties

From [kotlin.Throwable](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-throwable/index.html) `open https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-throwable/index.html?` `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-throwable/cause.html` `open https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html` `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-throwable/localized-message.html` `open https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-array/index.html<https://developer.android.com/reference/java/lang/StackTraceElement.html>` `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-throwable/stack-trace.html` `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-array/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-throwable/index.html>` `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-throwable/suppressed.html`

## Constants

### ERROR_INVALID_PACKAGE_NAME

```
const val ERROR_INVALID_PACKAGE_NAME: Int
```

The package name of the watch face is invalid.

The package name of the watch face must start with the package name of the Watch Face Push client, followed by the 'watchfacepush' keyword, ending with the unique watch face name. Developers should verify that the package name follows this format.

### ERROR_INVALID_VALIDATION_TOKEN

```
const val ERROR_INVALID_VALIDATION_TOKEN: Int
```

The validation token provided does not match the watch face.

Developers should see the Watch Face Push documentation to see how to generate a validation token correctly.

### ERROR_MALFORMED_WATCHFACE_APK

```
const val ERROR_MALFORMED_WATCHFACE_APK: Int
```

The provided watch face is not a valid Android APK.

Developers should ensure that the provided file is a valid APK file.

### ERROR_SLOT_LIMIT_REACHED

```
const val ERROR_SLOT_LIMIT_REACHED: Int
```

The limit of watch faces that can be installed by this application has been reached.

No more watch faces can be added. Developers should instruct the user to remove existing watch faces added by this app before attempting to add new ones.

### ERROR_UNEXPECTED_CONTENT

```
const val ERROR_UNEXPECTED_CONTENT: Int
```

Unexpected content in the APK.

The APK must be a WFF watchface which only contains the watchface XML file and the associated resources. The APK can't contain any executable code. Developers should ensure that the APK conforms to the Watch Face Format.

### ERROR_UNKNOWN

```
const val ERROR_UNKNOWN: Int
```

Unknown error while adding a watch face.

This typically means that the Watch Face Push service on the watch could not be accessed or that the watch may be in a bad state.

## Public constructors

### AddWatchFaceException

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/wear-watchfacepush#1.0.0)

```
AddWatchFaceException(errorCode: Int, rootCause: Throwable)
```

| Parameters |
|---|---|
| `errorCode: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The specific subtype of error occurred. See `https://developer.android.com/reference/kotlin/androidx/wear/watchfacepush/WatchFacePushManager.AddWatchFaceException.Companion.ErrorCode` for the possible values. |
| `rootCause: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-throwable/index.html` | The exception that caused the problem in the first place. |

## Public properties

### errorCode

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/wear-watchfacepush#1.0.0)

```
val errorCode: Int
```

The specific subtype of error occurred. See `https://developer.android.com/reference/kotlin/androidx/wear/watchfacepush/WatchFacePushManager.AddWatchFaceException.Companion.ErrorCode` for the possible values.

### message

```
open val message: String?
```