(err, own)
| 422 | }; |
| 423 | |
| 424 | function enhanceStackTrace(err, own) { |
| 425 | let ctorInfo = ''; |
| 426 | try { |
| 427 | const { name } = this.constructor; |
| 428 | if (name !== 'EventEmitter') |
| 429 | ctorInfo = ` on ${name} instance`; |
| 430 | } catch { |
| 431 | // Continue regardless of error. |
| 432 | } |
| 433 | const sep = `\nEmitted 'error' event${ctorInfo} at:\n`; |
| 434 | |
| 435 | const errStack = ArrayPrototypeSlice( |
| 436 | StringPrototypeSplit(err.stack, '\n'), 1); |
| 437 | const ownStack = ArrayPrototypeSlice( |
| 438 | StringPrototypeSplit(own.stack, '\n'), 1); |
| 439 | |
| 440 | const { len, offset } = identicalSequenceRange(ownStack, errStack); |
| 441 | if (len > 0) { |
| 442 | ArrayPrototypeSplice(ownStack, offset + 1, len - 2, |
| 443 | ' [... lines matching original stack trace ...]'); |
| 444 | } |
| 445 | |
| 446 | return err.stack + sep + ArrayPrototypeJoin(ownStack, '\n'); |
| 447 | } |
| 448 | |
| 449 | /** |
| 450 | * Synchronously calls each of the listeners registered |
nothing calls this directly
no test coverage detected
searching dependent graphs…