MCPcopy
hub / github.com/meteor/meteor / error

Function error

tools/utils/buildmessage.js:459–501  ·  view source on GitHub ↗
(message, options)

Source from the content-addressed store, hash-verified

457// on MessageSet which can search for errors with a specific named
458// tag.
459var error = function (message, options) {
460 options = options || {};
461
462 if (options.downcase) {
463 message = message.slice(0,1).toLowerCase() + message.slice(1);
464 }
465
466 if (! currentJob.get()) {
467 throw new Error("Error: " + message);
468 }
469
470 if (options.secondary && jobHasMessages()) {
471 // skip it
472 return;
473 }
474
475 var info = _.extend({
476 message: message
477 }, options);
478
479 if ('useMyCaller' in info) {
480 if (info.useMyCaller) {
481 const {
482 insideFiber,
483 outsideFiber
484 } = parseStack.parse(new Error());
485
486 // Concatenate and get rid of lines about Future and buildmessage
487 info.stack = outsideFiber.concat(insideFiber || []).slice(2);
488 if (typeof info.useMyCaller === 'number') {
489 info.stack = info.stack.slice(info.useMyCaller);
490 }
491 var caller = info.stack[0];
492 info.func = caller.func;
493 info.file = caller.file;
494 info.line = caller.line;
495 info.column = caller.column;
496 }
497 delete info.useMyCaller;
498 }
499
500 currentJob.get().addMessage(info);
501};
502
503// Record an exception. The message as well as any file and line
504// information be read directly out of the exception. If not in a job,

Callers

nothing calls this directly

Calls 4

jobHasMessagesFunction · 0.85
parseMethod · 0.65
getMethod · 0.45
extendMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…