MCPcopy Create free account
hub / github.com/TruthHun/BookStack / checkForgottenReturns

Function checkForgottenReturns

static/word2md/mammoth.browser.js:5073–5118  ·  view source on GitHub ↗
(returnValue, promiseCreated, name, promise,
                               parent)

Source from the content-addressed store, hash-verified

5071}
5072
5073function checkForgottenReturns(returnValue, promiseCreated, name, promise,
5074 parent) {
5075 if (returnValue === undefined && promiseCreated !== null &&
5076 wForgottenReturn) {
5077 if (parent !== undefined && parent._returnedNonUndefined()) return;
5078 if ((promise._bitField & 65535) === 0) return;
5079
5080 if (name) name = name + " ";
5081 var handlerLine = "";
5082 var creatorLine = "";
5083 if (promiseCreated._trace) {
5084 var traceLines = promiseCreated._trace.stack.split("\n");
5085 var stack = cleanStack(traceLines);
5086 for (var i = stack.length - 1; i >= 0; --i) {
5087 var line = stack[i];
5088 if (!nodeFramePattern.test(line)) {
5089 var lineMatches = line.match(parseLinePattern);
5090 if (lineMatches) {
5091 handlerLine = "at " + lineMatches[1] +
5092 ":" + lineMatches[2] + ":" + lineMatches[3] + " ";
5093 }
5094 break;
5095 }
5096 }
5097
5098 if (stack.length > 0) {
5099 var firstUserLine = stack[0];
5100 for (var i = 0; i < traceLines.length; ++i) {
5101
5102 if (traceLines[i] === firstUserLine) {
5103 if (i > 0) {
5104 creatorLine = "\n" + traceLines[i - 1];
5105 }
5106 break;
5107 }
5108 }
5109
5110 }
5111 }
5112 var msg = "a promise was created in a " + name +
5113 "handler " + handlerLine + "but was not returned from it, " +
5114 "see http://goo.gl/rRqMUw" +
5115 creatorLine;
5116 promise._warn(msg, true, promiseCreated);
5117 }
5118}
5119
5120function deprecated(name, replacement) {
5121 var message = name +

Callers

nothing calls this directly

Calls 1

cleanStackFunction · 0.70

Tested by

no test coverage detected