ad.addAdEventListener(AdEventType.ERROR, error => {
if (error.phase === 'show') {
reportPresentationFailure(error);
} else if (error.reason === 'no-fill' || error.reason === 'mediation-no-fill') {
scheduleRetry();
} else {
reportLoadFailure(error);
}
});
NativeError itself is deliberately not widened: it is shared with legacy
code paths that have no structured payload to supply.
The single error type every v17 hook and multi-format load result uses.
It is a real
Error(it can be thrown, and it has astack) that also carries the structured payload, soreason/phase/responseInfobranching works on a hook error exactly as documented, rather than readingundefined.This mirrors the classic event path, where the payload of an
AdEventTypeERRORevent isError & AdErrorPayload. One shape, both delivery styles.Branch on
phasebeforereason: a show-phaseno-fillis still a presentation failure, while a load-phaseno-fillis routine inventory emptiness.