# firebase::gma::AdError Class Reference

# firebase::gma::AdError


`#include <types.h>`

Information about why an ad operation failed.

## Summary

| ### Constructors and Destructors ||
|---|---|
| `AdError()` Default Constructor. ||
| `AdError(const AdError & ad_error)` Copy Constructor. ||
| `~AdError()` Destructor. ||

| ### Public static attributes ||
|---|---|
| `kUndefinedDomain` | `const char *const` A domain string which represents an undefined error domain. |

| ### Public functions ||
|---|---|
| `GetCause() const ` | `std::unique_ptr< AdError >` Retrieves an [AdError](https://developers.google.com/admob/cpp/reference/class/firebase/gma/ad-error.md.txt#classfirebase_1_1gma_1_1_ad_error) which represents the cause of this error. |
| `ToString() const ` | `virtual const std::string &` Returns a log friendly string version of this object. |
| `code() const ` | `AdErrorCode` Gets the error's code. |
| `domain() const ` | `const std::string &` Gets the domain of the error. |
| `message() const ` | `const std::string &` Gets the message describing the error. |
| `operator=(const AdError & obj)` | `AdError &` Assignment operator. |
| `response_info() const ` | `const ResponseInfo &` Gets the [ResponseInfo](https://developers.google.com/admob/cpp/reference/class/firebase/gma/response-info.md.txt#classfirebase_1_1gma_1_1_response_info) if an error occurred during a loadAd operation. |

## Public static attributes

### kUndefinedDomain

```c++
const char *const kUndefinedDomain
```
A domain string which represents an undefined error domain.

The GMA SDK returns this domain for [domain()](https://developers.google.com/admob/cpp/reference/class/firebase/gma/ad-error.md.txt#classfirebase_1_1gma_1_1_ad_error_1a74009bc70cd1531c52cf53c3ddbf5669) method invocations when converting error information from legacy mediation adapter callbacks.

## Public functions

### AdError

```c++
 AdError()
```
Default Constructor.

### AdError

```c++
 AdError(
  const AdError & ad_error
)
```
Copy Constructor.

### GetCause

```c++
std::unique_ptr< AdError > GetCause() const 
```
Retrieves an [AdError](https://developers.google.com/admob/cpp/reference/class/firebase/gma/ad-error.md.txt#classfirebase_1_1gma_1_1_ad_error) which represents the cause of this error.


| Details ||
|---|---|
| **Returns** | a pointer to an adError which represents the cause of this [AdError](https://developers.google.com/admob/cpp/reference/class/firebase/gma/ad-error.md.txt#classfirebase_1_1gma_1_1_ad_error). If there was no cause then nullptr is returned. |

### ToString

```c++
virtual const std::string & ToString() const 
```
Returns a log friendly string version of this object.

### code

```c++
AdErrorCode code() const 
```
Gets the error's code.

### domain

```c++
const std::string & domain() const 
```
Gets the domain of the error.

### message

```c++
const std::string & message() const 
```
Gets the message describing the error.

### operator=

```c++
AdError & operator=(
  const AdError & obj
)
```
Assignment operator.

### response_info

```c++
const ResponseInfo & response_info() const 
```
Gets the [ResponseInfo](https://developers.google.com/admob/cpp/reference/class/firebase/gma/response-info.md.txt#classfirebase_1_1gma_1_1_response_info) if an error occurred during a loadAd operation.

The [ResponseInfo](https://developers.google.com/admob/cpp/reference/class/firebase/gma/response-info.md.txt#classfirebase_1_1gma_1_1_response_info) will have empty fields if this [AdError](https://developers.google.com/admob/cpp/reference/class/firebase/gma/ad-error.md.txt#classfirebase_1_1gma_1_1_ad_error) does not represent an error stemming from a load ad operation.

### \~AdError

```c++
virtual  ~AdError()
```
Destructor.