AdError

Kotlin|Java

public classAdError

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 finalString
UNDEFINED_DOMAIN = "undefined"

The undefined error domain.

Public fields

final @NullableAdError
final int
final @NonNullString
final @NonNullString

Public constructors

AdError(int code, @NonNullString message, @NonNullString domain)

Creates anAdError.

AdError(
    int code,
    @NonNullString message,
    @NonNullString domain,
    @NullableAdError cause
)

Creates anAdError with an underlyingcause.

Public methods

@NullableAdError

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

int

Gets the error's code.

@NonNullString

Gets the domain of the error.

@NonNullString

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 forgetDomain when converting error information from legacy mediation adapter callbacks likeonFailure to anAdError.

Public fields

cause

public final @NullableAdError cause

code

public final int code

domain

public final @NonNullString domain

message

public final @NonNullString message

Public constructors

AdError

public AdError(int code, @NonNullString message, @NonNullString domain)

Creates anAdError.

Parameters
int code

the error code.

@NonNullString message

a message detailing the error.

@NonNullString domain

the error domain.

AdError

public AdError(
    int code,
    @NonNullString message,
    @NonNullString domain,
    @NullableAdError cause
)

Creates anAdError with an underlyingcause.

Parameters
int code

the error code.

@NonNullString message

a message detailing the error.

@NonNullString domain

the error domain.

@NullableAdError cause

the cause of this error.

Public methods

getCause

public @NullableAdError getCause()

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

getCode

public int getCode()

Gets the error's code.

getDomain

public @NonNullString getDomain()

Gets the domain of the error.

Returns
@NonNullString

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

getMessage

public @NonNullString getMessage()

Gets the message describing the error.

toString

public String toString()

Returns a log friendly string version of this object.

Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2025-08-20 UTC.