AdsMediaSource.AdLoadException


public final class AdsMediaSource.AdLoadException extends IOException


Wrapper for exceptions that occur while loading ads, which are notified via onLoadError.

Summary

Nested types

@Documented
@Retention(value = RetentionPolicy.SOURCE)
@Target(value = TYPE_USE)
@IntDef(value = )
public annotation AdsMediaSource.AdLoadException.Type

Types of ad load exceptions.

Constants

static final int

Type for when an ad failed to load.

static final int

Type for when an ad group failed to load.

static final int

Type for when all ad groups failed to load.

static final int

Type for when an unexpected error occurred while loading ads.

Public fields

final int

The Type of the ad load exception.

Public methods

static AdsMediaSource.AdLoadException

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

Returns a new ad load exception of TYPE_ALL_ADS.

static AdsMediaSource.AdLoadException

Returns a new ad load exception of TYPE_UNEXPECTED.

RuntimeException

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

Inherited methods

From java.lang.Throwable
synchronized final void
synchronized Throwable
synchronized Throwable
String
String
StackTraceElement[]
synchronized final Throwable[]
synchronized Throwable
void
void
setStackTrace(StackTraceElement[] stackTrace)
String

Constants

TYPE_AD

public static final int TYPE_AD = 0

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

TYPE_AD_GROUP

public static final int TYPE_AD_GROUP = 1

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

TYPE_ALL_ADS

public static final int TYPE_ALL_ADS = 2

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

TYPE_UNEXPECTED

public static final int TYPE_UNEXPECTED = 3

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

Public fields

type

@AdsMediaSource.AdLoadException.Type
public final int type

The Type of the ad load exception.

Public methods

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.