AdError

public class AdError

Known direct subclasses
AdInspectorError

Error information about why the ad inspector failed.

LoadAdError

Error information about why an ad load operation failed.


Error information about why an ad operation failed.

Summary

Constants

static final String
UNDEFINED_DOMAIN = "undefined"

The undefined error domain.

Public fields

final @Nullable AdError
final int
final @NonNull String
final @NonNull String

Public constructors

AdError(int code, @NonNull String message, @NonNull String domain)

Creates an AdError.

AdError(
    int code,
    @NonNull String message,
    @NonNull String domain,
    @Nullable AdError cause
)

Creates an AdError with an underlying cause.

Public methods

@Nullable AdError

Gets the cause of this error or null if the cause is nonexistent or unknown.

int

Gets the error's code.

@NonNull String

Gets the domain of the error.

@NonNull String

Gets the message describing the error.

String

Returns a log friendly string version of this object.

Constants

UNDEFINED_DOMAIN

public static final String UNDEFINED_DOMAIN = "undefined"

The undefined error domain.

The Google Mobile Ads SDK returns this domain for getDomain when converting error information from legacy mediation adapter callbacks like onFailure to an AdError.

Public fields

cause

public final @Nullable AdError cause

code

public final int code

domain

public final @NonNull String domain

message

public final @NonNull String message

Public constructors

AdError

public AdError(int code, @NonNull String message, @NonNull String domain)

Creates an AdError.

Parameters
int code

the error code.

@NonNull String message

a message detailing the error.

@NonNull String domain

the error domain.

AdError

public AdError(
    int code,
    @NonNull String message,
    @NonNull String domain,
    @Nullable AdError cause
)

Creates an AdError with an underlying cause.

Parameters
int code

the error code.

@NonNull String message

a message detailing the error.

@NonNull String domain

the error domain.

@Nullable AdError cause

the cause of this error.

Public methods

getCause

public @Nullable AdError getCause()

Gets the cause of this error or null if the cause is nonexistent or unknown.

getCode

public int getCode()

Gets the error's code.

getDomain

public @NonNull String getDomain()

Gets the domain of the error.

Returns
@NonNull String

ERROR_DOMAIN for Google Mobile Ads SDK errors, or a domain defined by mediation networks for mediation errors.

getMessage

public @NonNull String getMessage()

Gets the message describing the error.

toString

public String toString()

Returns a log friendly string version of this object.