Skip to content

Commit

Permalink
🕵️ Improve logging to debug missing Resource issue. (#26506)
Browse files Browse the repository at this point in the history
* Improve logging to debug missing Resource issue.

* userAssert --> devAssert

* getMode() --> getMode().runtime

* devAssert --> dev().error

* where did the mode go

* TAG_
  • Loading branch information
samouri committed Jan 29, 2020
1 parent 4455a03 commit e1e266b
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/service/resources-impl.js
Expand Up @@ -28,6 +28,7 @@ import {closest, hasNextNodeInDocumentOrder} from '../dom';
import {computedStyle} from '../style';
import {dev, devAssert} from '../log';
import {dict} from '../utils/object';
import {getMode} from '../mode';
import {getSourceUrl} from '../url';
import {checkAndFix as ieMediaCheckAndFix} from './ie-media-bug';
import {isBlockedByConsent, reportError} from '../error';
Expand Down Expand Up @@ -624,6 +625,14 @@ export class ResourcesImpl {
const ampElements = element.getElementsByClassName('i-amphtml-element');
for (let i = 0; i < ampElements.length; i++) {
const r = Resource.forElement(ampElements[i]);
if (typeof r === 'undefined') {
dev().error(
TAG_,
'AMP Element is missing an associated resource. Element: %s, Runtime: %s',
ampElements[i],
getMode().runtime
);
}
r.requestMeasure();
}
if (relayoutTop != -1) {
Expand Down

0 comments on commit e1e266b

Please sign in to comment.