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

Function buildErrorMessage_

src/error-reporting.js:463–477  ·  view source on GitHub ↗

* @param {string|undefined} message * @param {*|undefined} error * @return {string}

(message, error)

Source from the content-addressed store, hash-verified

461 * @return {string}
462 */
463function buildErrorMessage_(message, error) {
464 if (error) {
465 if (error.message) {
466 message = error.message;
467 } else {
468 // This should never be a string, but sometimes it is.
469 message = String(error);
470 }
471 }
472 if (!message) {
473 message = 'Unknown error';
474 }
475
476 return message;
477}
478
479/**
480 * Signature designed, so it can work with window.onerror

Callers 1

getErrorReportDataFunction · 0.85

Calls 1

StringFunction · 0.50

Tested by

no test coverage detected