MCPcopy
hub / github.com/ampproject/amphtml / expandMessageArgs_

Method expandMessageArgs_

src/utils/log.js:351–365  ·  view source on GitHub ↗

* Either redirects a pair of (errorId, ...args) to a URL where the full * message is displayed, or displays it from a fetched table. * * This method is used by the output of the `transform-log-methods` babel * plugin. It should not be used directly. Use the (*error|assert*|info|warn)

(parts)

Source from the content-addressed store, hash-verified

349 * @private
350 */
351 expandMessageArgs_(parts) {
352 // First value should exist.
353 const id = parts.shift();
354 // Best effort fetch of message template table.
355 // Since this is async, the first few logs might be indirected to a URL even
356 // if in development mode. Message table is ~small so this should be a short
357 // gap.
358 if (getMode(this.win).development) {
359 this.fetchExternalMessagesOnce_();
360 }
361
362 return this.messages_?.[id]
363 ? [this.messages_[id]].concat(parts)
364 : [`More info at ${externalMessageUrl(id, parts)}`];
365 }
366
367 /**
368 * Throws an error if the first argument isn't trueish.

Callers 3

assertMethod · 0.95
test-log.jsFile · 0.80

Calls 3

getModeFunction · 0.90
externalMessageUrlFunction · 0.85
concatMethod · 0.80

Tested by

no test coverage detected