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

Function getChannelError

src/service/viewer-impl.js:928–940  ·  view source on GitHub ↗

* Creates a dev error for the case where a channel cannot be established. * @param {*=} opt_reason * @return {!Error}

(opt_reason)

Source from the content-addressed store, hash-verified

926 * @return {!Error}
927 */
928function getChannelError(opt_reason) {
929 let channelError;
930 if (opt_reason instanceof Error) {
931 opt_reason = duplicateErrorIfNecessary(opt_reason);
932 opt_reason.message = 'No messaging channel: ' + opt_reason.message;
933 channelError = opt_reason;
934 } else {
935 channelError = new Error('No messaging channel: ' + opt_reason);
936 }
937 // Force convert user error to dev error
938 channelError.message = stripUserError(channelError.message);
939 return channelError;
940}
941
942/**
943 * @param {!./ampdoc-impl.AmpDoc} ampdoc

Callers 2

initMessagingChannel_Method · 0.85
sendMessageInternal_Method · 0.85

Calls 2

stripUserErrorFunction · 0.90

Tested by

no test coverage detected