Added in [API level 29](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

# DnsException

*** ** * ** ***

```
class DnsException : Exception
```

|---|---|---|---|
| [kotlin.Any](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html) ||||
| ↳ | [kotlin.Throwable](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-throwable/index.html) |||
|   | ↳ | [java.lang.Exception](https://developer.android.com/reference/kotlin/java/lang/Exception.html#) ||
|   |   | ↳ | [android.net.DnsResolver.DnsException](https://developer.android.com/reference/kotlin/android/net/DnsResolver.DnsException#) |

Class to represent DNS error

## Summary

| Public constructors ||
|---|---|
| `https://developer.android.com/reference/kotlin/android/net/DnsResolver.DnsException#DnsException(kotlin.Int,%20kotlin.Throwable)(code: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html, cause: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-throwable/index.html?)` <br /> |

| Properties ||
|---|---|
| [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | `https://developer.android.com/reference/kotlin/android/net/DnsResolver.DnsException#code:kotlin.Int` DNS error code as one of the ERROR_\* constants. |

## Public constructors

### DnsException

Added in [API level 33](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  
Also in [S Extensions 3](https://developer.android.com/sdkExtensions)

```
DnsException(
    code: Int, 
    cause: Throwable?)
```

| Parameters ||
|---|---|
| `code` | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html): Value is one of the following: - `https://developer.android.com/reference/kotlin/android/net/DnsResolver#ERROR_PARSE:kotlin.Int` - `https://developer.android.com/reference/kotlin/android/net/DnsResolver#ERROR_SYSTEM:kotlin.Int` |
| `cause` | [Throwable](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-throwable/index.html)?: This value may be `null`. |

## Properties

### code

Added in [API level 29](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
val code: Int
```

DNS error code as one of the ERROR_\* constants.   
Value is one of the following:

- `https://developer.android.com/reference/kotlin/android/net/DnsResolver#ERROR_PARSE:kotlin.Int`
- `https://developer.android.com/reference/kotlin/android/net/DnsResolver#ERROR_SYSTEM:kotlin.Int`

<br />