Package com.google.android.exoplayer2.source.ads

## Class AdsMediaSource.AdLoadException

- java.lang.Object
- - java.lang.Throwable
  - - java.lang.Exception
    - - java.io.IOException
      - - com.google.android.exoplayer2.source.ads.AdsMediaSource.AdLoadException

- All Implemented Interfaces:
    `Serializable`
  Enclosing class:
    AdsMediaSource

      public static final class AdsMediaSource.AdLoadException
      extends IOException

  Wrapper for exceptions that occur while loading ads, which are notified via `MediaSourceEventListener.onLoadError(int, MediaPeriodId, LoadEventInfo, MediaLoadData, IOException, boolean)`.
  See Also:
    Serialized Form

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class | Description
    --- | --- | ---
    `static interface` | `AdsMediaSource.AdLoadException.Type` | Types of ad load exceptions.

  - ### Field Summary

    Fields
    Modifier and Type | Field | Description
    --- | --- | ---
    `int` | `type` | The `AdsMediaSource.AdLoadException.Type` of the ad load exception.
    `static int` | `TYPE_AD` | Type for when an ad failed to load.
    `static int` | `TYPE_AD_GROUP` | Type for when an ad group failed to load.
    `static int` | `TYPE_ALL_ADS` | Type for when all ad groups failed to load.
    `static int` | `TYPE_UNEXPECTED` | Type for when an unexpected error occurred while loading ads.

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `static AdsMediaSource.AdLoadException` | `createForAd​(Exception error)` | Returns a new ad load exception of `TYPE_AD`.
    `static AdsMediaSource.AdLoadException` | `createForAdGroup​(Exception error, int adGroupIndex)` | Returns a new ad load exception of `TYPE_AD_GROUP`.
    `static AdsMediaSource.AdLoadException` | `createForAllAds​(Exception error)` | Returns a new ad load exception of `TYPE_ALL_ADS`.
    `static AdsMediaSource.AdLoadException` | `createForUnexpected​(RuntimeException error)` | Returns a new ad load exception of `TYPE_UNEXPECTED`.
    `RuntimeException` | `getRuntimeExceptionForUnexpected()` | Returns the `RuntimeException` that caused the exception if its type is `TYPE_UNEXPECTED`.

    - ### Methods inherited from class java.lang.Throwable

      `addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- - ### Field Detail

    - #### TYPE_AD

          public static final int TYPE_AD

      Type for when an ad failed to load. The ad will be skipped.
      See Also:
        Constant Field Values

    - #### TYPE_AD_GROUP

          public static final int TYPE_AD_GROUP

      Type for when an ad group failed to load. The ad group will be skipped.
      See Also:
        Constant Field Values

    - #### TYPE_ALL_ADS

          public static final int TYPE_ALL_ADS

      Type for when all ad groups failed to load. All ads will be skipped.
      See Also:
        Constant Field Values

    - #### TYPE_UNEXPECTED

          public static final int TYPE_UNEXPECTED

      Type for when an unexpected error occurred while loading ads. All ads will be skipped.
      See Also:
        Constant Field Values

    - #### type

          @Type
          public final int type

      The `AdsMediaSource.AdLoadException.Type` of the ad load exception.

  - ### Method Detail

    - #### createForAd

          public static AdsMediaSource.AdLoadException createForAd​(Exception error)

      Returns a new ad load exception of `TYPE_AD`.

    - #### createForAdGroup

          public static AdsMediaSource.AdLoadException createForAdGroup​(Exception error,
                                                                        int adGroupIndex)

      Returns a new ad load exception of `TYPE_AD_GROUP`.

    - #### createForAllAds

          public static AdsMediaSource.AdLoadException createForAllAds​(Exception error)

      Returns a new ad load exception of `TYPE_ALL_ADS`.

    - #### createForUnexpected

          public static AdsMediaSource.AdLoadException createForUnexpected​(RuntimeException error)

      Returns a new ad load exception of `TYPE_UNEXPECTED`.

    - #### getRuntimeExceptionForUnexpected

          public RuntimeException getRuntimeExceptionForUnexpected()

      Returns the `RuntimeException` that caused the exception if its type is `TYPE_UNEXPECTED`.