> Documentation index: https://developer.android.com/reference/llms.txt

# JavaScriptExecutionException

Artifact: [androidx.webkit:webkit](https://developer.android.com/jetpack/androidx/releases/webkit.md.txt) [View Source](https://cs.android.com/search?q=file:androidx/webkit/JavaScriptExecutionException.java+class:androidx.webkit.JavaScriptExecutionException) Added in [1.16.0](https://developer.android.com/jetpack/androidx/releases/webkit.md.txt#1.16.0)

*** ** * ** ***


```
class JavaScriptExecutionException : 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.md.txt) ||
|   |   | ↳ | [androidx.webkit.JavaScriptExecutionException](https://developer.android.com/reference/kotlin/androidx/webkit/JavaScriptExecutionException.md.txt) |

*** ** * ** ***

Exception thrown when there was an error executing JavaScript via `executeJavaScript`.

## Summary

| ### Constants |
|---|---|
| `const Int` | `ERROR_FRAME_DESTROYED = 1` Error code for the web frame that was executing JavaScript was destroyed before execution. |
| `const Int` | `ERROR_GENERIC = 0` Error code for a generic/unknown error occurred while executing JavaScript. |

| ### Public functions |
|---|---|
| `Int` | `getErrorType()` Returns the type of error that caused this exception. |

### Inherited functions

From [java.lang.Throwable](https://developer.android.com/reference/java/lang/Throwable.md.txt) `synchronized Unit` `addSuppressed(exception: Throwable!)` `synchronized Throwable!` `fillInStackTrace()` `synchronized Throwable!` `getCause()` `String!` `getLocalizedMessage()` `String!` `getMessage()` `Array<StackTraceElement!>!` `getStackTrace()` `synchronized Array<Throwable!>!` `getSuppressed()` `synchronized Throwable!` `initCause(cause: Throwable!)` `Unit` `printStackTrace()` `Unit` `setStackTrace(stackTrace: Array<StackTraceElement!>!)` `String!` `toString()`

## Constants

### ERROR_FRAME_DESTROYED

Added in [1.16.0](https://developer.android.com/jetpack/androidx/releases/webkit.md.txt#1.16.0)

```
const val ERROR_FRAME_DESTROYED = 1: Int
```

Error code for the web frame that was executing JavaScript was destroyed before execution.

### ERROR_GENERIC

Added in [1.16.0](https://developer.android.com/jetpack/androidx/releases/webkit.md.txt#1.16.0)

```
const val ERROR_GENERIC = 0: Int
```

Error code for a generic/unknown error occurred while executing JavaScript.

## Public functions

### getErrorType

Added in [1.16.0](https://developer.android.com/jetpack/androidx/releases/webkit.md.txt#1.16.0)

```
fun getErrorType(): Int
```

Returns the type of error that caused this exception. See `ERROR_FRAME_DESTROYED` and `ERROR_GENERIC`.