# AdsMediaSource.AdLoadException

Artifact: [androidx.media3:media3-exoplayer](https://developer.android.com/jetpack/androidx/releases/media3) [View Source](https://cs.android.com/search?q=file:androidx/media3/exoplayer/source/ads/AdsMediaSource.java+class:androidx.media3.exoplayer.source.ads.AdsMediaSource.AdLoadException)

*** ** * ** ***


```
class AdsMediaSource.AdLoadException : IOException
```

<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) |||
|   |   | ↳ | [java.io.IOException](https://developer.android.com/reference/java/io/IOException.html) ||
|   |   |   | ↳ | [androidx.media3.exoplayer.source.ads.AdsMediaSource.AdLoadException](https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/ads/AdsMediaSource.AdLoadException) |

*** ** * ** ***

Wrapper for exceptions that occur while loading ads, which are notified via `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/MediaSourceEventListener#onLoadError(int,androidx.media3.exoplayer.source.MediaSource.MediaPeriodId,androidx.media3.exoplayer.source.LoadEventInfo,androidx.media3.exoplayer.source.MediaLoadData,java.io.IOException,boolean)`.

## Summary

| ### Nested types |
|---|
| `@https://developer.android.com/reference/java/lang/annotation/Documented.html @https://developer.android.com/reference/java/lang/annotation/Retention.html(value = https://developer.android.com/reference/java/lang/annotation/RetentionPolicy.html#SOURCE) @https://developer.android.com/reference/java/lang/annotation/Target.html(value = https://developer.android.com/reference/java/lang/annotation/ElementType.html#TYPE_USE) @https://developer.android.com/reference/kotlin/androidx/annotation/IntDef(value = ) annotation https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/ads/AdsMediaSource.AdLoadException.Type` Types of ad load exceptions. |

| ### Constants |
|---|---|
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/ads/AdsMediaSource.AdLoadException#TYPE_AD() = 0` Type for when an ad failed to load. |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/ads/AdsMediaSource.AdLoadException#TYPE_AD_GROUP() = 1` Type for when an ad group failed to load. |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/ads/AdsMediaSource.AdLoadException#TYPE_ALL_ADS() = 2` Type for when all ad groups failed to load. |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/ads/AdsMediaSource.AdLoadException#TYPE_UNEXPECTED() = 3` Type for when an unexpected error occurred while loading ads. |

| ### Public functions |
|---|---|
| `java-static https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/ads/AdsMediaSource.AdLoadException!` | `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/ads/AdsMediaSource.AdLoadException#createForAd(java.lang.Exception)(error: https://developer.android.com/reference/java/lang/Exception.html!)` Returns a new ad load exception of `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/ads/AdsMediaSource.AdLoadException#TYPE_AD()`. |
| `java-static https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/ads/AdsMediaSource.AdLoadException!` | `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/ads/AdsMediaSource.AdLoadException#createForAdGroup(java.lang.Exception,int)(error: https://developer.android.com/reference/java/lang/Exception.html!, adGroupIndex: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)` Returns a new ad load exception of `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/ads/AdsMediaSource.AdLoadException#TYPE_AD_GROUP()`. |
| `java-static https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/ads/AdsMediaSource.AdLoadException!` | `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/ads/AdsMediaSource.AdLoadException#createForAllAds(java.lang.Exception)(error: https://developer.android.com/reference/java/lang/Exception.html!)` Returns a new ad load exception of `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/ads/AdsMediaSource.AdLoadException#TYPE_ALL_ADS()`. |
| `java-static https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/ads/AdsMediaSource.AdLoadException!` | `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/ads/AdsMediaSource.AdLoadException#createForUnexpected(java.lang.RuntimeException)(error: https://developer.android.com/reference/java/lang/RuntimeException.html!)` Returns a new ad load exception of `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/ads/AdsMediaSource.AdLoadException#TYPE_UNEXPECTED()`. |
| `https://developer.android.com/reference/java/lang/RuntimeException.html!` | `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/ads/AdsMediaSource.AdLoadException#getRuntimeExceptionForUnexpected()()` Returns the `https://developer.android.com/reference/java/lang/RuntimeException.html` that caused the exception if its type is `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/ads/AdsMediaSource.AdLoadException#TYPE_UNEXPECTED()`. |

| ### Public properties |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `@https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/ads/AdsMediaSource.AdLoadException.Type https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/ads/AdsMediaSource.AdLoadException#type()` The `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/ads/AdsMediaSource.AdLoadException.Type` of the ad load exception. |

| ### Inherited functions |
|---|
| From [java.lang.Throwable](https://developer.android.com/reference/java/lang/Throwable.html) |---|---| | `synchronized 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!)` | | `synchronized 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()` | | `synchronized https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-throwable/index.html!` | `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-throwable/get-cause.html()` | | `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html!` | `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-throwable/get-localized-message.html()` | | `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html!` | `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-throwable/get-message.html()` | | `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/get-stack-trace.html()` | | `synchronized 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/get-suppressed.html()` | | `synchronized 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/set-stack-trace.html(stackTrace: 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/-string/index.html!` | `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-throwable/to-string.html()` | |

## Constants

### TYPE_AD

```
const val TYPE_AD = 0: Int
```

Type for when an ad failed to load. The ad will be skipped.

### TYPE_AD_GROUP

```
const val TYPE_AD_GROUP = 1: Int
```

Type for when an ad group failed to load. The ad group will be skipped.

### TYPE_ALL_ADS

```
const val TYPE_ALL_ADS = 2: Int
```

Type for when all ad groups failed to load. All ads will be skipped.

### TYPE_UNEXPECTED

```
const val TYPE_UNEXPECTED = 3: Int
```

Type for when an unexpected error occurred while loading ads. All ads will be skipped.

## Public functions

### createForAd

```
java-static fun createForAd(error: Exception!): AdsMediaSource.AdLoadException!
```

Returns a new ad load exception of `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/ads/AdsMediaSource.AdLoadException#TYPE_AD()`.

### createForAdGroup

```
java-static fun createForAdGroup(error: Exception!, adGroupIndex: Int): AdsMediaSource.AdLoadException!
```

Returns a new ad load exception of `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/ads/AdsMediaSource.AdLoadException#TYPE_AD_GROUP()`.

### createForAllAds

```
java-static fun createForAllAds(error: Exception!): AdsMediaSource.AdLoadException!
```

Returns a new ad load exception of `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/ads/AdsMediaSource.AdLoadException#TYPE_ALL_ADS()`.

### createForUnexpected

```
java-static fun createForUnexpected(error: RuntimeException!): AdsMediaSource.AdLoadException!
```

Returns a new ad load exception of `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/ads/AdsMediaSource.AdLoadException#TYPE_UNEXPECTED()`.

### getRuntimeExceptionForUnexpected

```
fun getRuntimeExceptionForUnexpected(): RuntimeException!
```

Returns the `https://developer.android.com/reference/java/lang/RuntimeException.html` that caused the exception if its type is `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/ads/AdsMediaSource.AdLoadException#TYPE_UNEXPECTED()`.

## Public properties

### type

```
@AdsMediaSource.AdLoadException.Type
val type: Int
```

The `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/ads/AdsMediaSource.AdLoadException.Type` of the ad load exception.