(message, options)
| 457 | // on MessageSet which can search for errors with a specific named |
| 458 | // tag. |
| 459 | var 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, |
nothing calls this directly
no test coverage detected
searching dependent graphs…