Stay organized with collections
Save and categorize content based on your preferences.
subdirectory_arrow_rightExtends Error
AdError surfaces information to the user about whether a failure occurred during ad loading
or playing. The errorType accessor provides information about whether the error occurred
during ad loading or ad playing.
Inner error that occurred during processing, or null if this information is
unavailable. This error may either be a native error or an AdError, a subclass
of a native error. This may return null if the error that caused this one is not
available.
getMessage
getMessage(): string
Returns the message for this error.
Returns
string
The message for this error.
getType
getType(): string
Returns the type of this error.
Returns
string
The type of this error, as defined in AdError.Type.
getVastErrorCode
getVastErrorCode(): number
Returns the VAST error code.
Returns
number
If VAST error code is available, returns it, otherwise returns
AdError.ErrorCode.UNKNOWN_ERROR.
[null,null,["Last updated 2025-03-26 UTC."],[[["\u003cp\u003e\u003ccode\u003eAdError\u003c/code\u003e provides details about failures during ad loading or playing, distinguishing between these two error types.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003eAdError\u003c/code\u003e class includes properties like \u003ccode\u003ecause\u003c/code\u003e, \u003ccode\u003emessage\u003c/code\u003e, \u003ccode\u003ename\u003c/code\u003e, and \u003ccode\u003estack\u003c/code\u003e to describe the error.\u003c/p\u003e\n"],["\u003cp\u003eMethods available in \u003ccode\u003eAdError\u003c/code\u003e include \u003ccode\u003egetErrorCode\u003c/code\u003e, \u003ccode\u003egetInnerError\u003c/code\u003e, \u003ccode\u003egetMessage\u003c/code\u003e, \u003ccode\u003egetType\u003c/code\u003e, and \u003ccode\u003egetVastErrorCode\u003c/code\u003e, offering different ways to retrieve information about the error.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003egetInnerError\u003c/code\u003e method returns the error that caused the current error, which can be either a native error or an \u003ccode\u003eAdError\u003c/code\u003e instance, or it can be null if no inner error is present.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003egetVastErrorCode\u003c/code\u003e method can be used to retrieve the VAST error code if available or the default \u003ccode\u003eAdError.ErrorCode.UNKNOWN_ERROR\u003c/code\u003e if not available.\u003c/p\u003e\n"]]],[],null,["# Interface AdError\n\n| **Note:** This reference page follows TypeScript documentation structure. If you have suggestions for or see issues with the reference documentation, open a thread with your feedback on the [IMA technical forum](https://groups.google.com/g/ima-sdk/).\n\n*** ** * ** ***\n\nsubdirectory_arrow_rightExtends Error \nAdError surfaces information to the user about whether a failure occurred during ad loading or playing. The errorType accessor provides information about whether the error occurred during ad loading or ad playing.\n\n| Properties ||\n|---------------------------------------------------------------------------------------------------------------------------------|---|\n| [message](/interactive-media-ads/docs/sdks/html5/client-side/reference/interface/google.ima.AdError#google.ima.AdError.message) | |\n| [name](/interactive-media-ads/docs/sdks/html5/client-side/reference/interface/google.ima.AdError#google.ima.AdError.name) | |\n| [stack?](/interactive-media-ads/docs/sdks/html5/client-side/reference/interface/google.ima.AdError#google.ima.AdError.stack) | |\n\n| Methods ||\n|---------------------------------------------------------------------------------------------------------------------------------------------------|-----------------------------------------|\n| [getErrorCode](/interactive-media-ads/docs/sdks/html5/client-side/reference/interface/google.ima.AdError#google.ima.AdError.getErrorCode) | Returns the error code. |\n| [getInnerError](/interactive-media-ads/docs/sdks/html5/client-side/reference/interface/google.ima.AdError#google.ima.AdError.getInnerError) | Returns the Error that caused this one. |\n| [getMessage](/interactive-media-ads/docs/sdks/html5/client-side/reference/interface/google.ima.AdError#google.ima.AdError.getMessage) | Returns the message for this error. |\n| [getType](/interactive-media-ads/docs/sdks/html5/client-side/reference/interface/google.ima.AdError#google.ima.AdError.getType) | Returns the type of this error. |\n| [getVastErrorCode](/interactive-media-ads/docs/sdks/html5/client-side/reference/interface/google.ima.AdError#google.ima.AdError.getVastErrorCode) | Returns the VAST error code. |\n\nProperties\n----------\n\n*** ** * ** ***\n\n### message\n\nmessage:` `string\n\n*** ** * ** ***\n\n### name\n\nname:` `string\n\n*** ** * ** ***\n\n### `Optional` stack\n\nstack?:` `string\n\nMethods\n-------\n\n*** ** * ** ***\n\n### getErrorCode\n\ngetErrorCode(): number \nReturns the error code.\n\n| Returns ||\n|--------|--------------------------------------------------|\n| number | The error code, as defined in AdError.ErrorCode. |\n\n*** ** * ** ***\n\n### getInnerError\n\ngetInnerError(): Error \nReturns the Error that caused this one.\n\n| Returns ||\n|-------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| Error | Inner error that occurred during processing, or null if this information is unavailable. This error may either be a native error or an AdError, a subclass of a native error. This may return null if the error that caused this one is not available. |\n\n*** ** * ** ***\n\n### getMessage\n\ngetMessage(): string \nReturns the message for this error.\n\n| Returns ||\n|--------|-----------------------------|\n| string | The message for this error. |\n\n*** ** * ** ***\n\n### getType\n\ngetType(): string \nReturns the type of this error.\n\n| Returns ||\n|--------|-----------------------------------------------------|\n| string | The type of this error, as defined in AdError.Type. |\n\n*** ** * ** ***\n\n### getVastErrorCode\n\ngetVastErrorCode(): number \nReturns the VAST error code.\n\n| Returns ||\n|--------|-------------------------------------------------------------------------------------------------|\n| number | If VAST error code is available, returns it, otherwise returns AdError.ErrorCode.UNKNOWN_ERROR. |"]]