(error, fallbackMessage)
| 679 | * @param {string} fallbackMessage fallback message |
| 680 | */ |
| 681 | const handleError = (error, fallbackMessage) => { |
| 682 | const errorObject = |
| 683 | error instanceof Error |
| 684 | ? error |
| 685 | : new Error(error || fallbackMessage, { cause: error }); |
| 686 | |
| 687 | const shouldDisplay = |
| 688 | typeof options.catchRuntimeError === "function" |
| 689 | ? options.catchRuntimeError(errorObject) |
| 690 | : true; |
| 691 | |
| 692 | if (shouldDisplay) { |
| 693 | overlayService.send({ |
| 694 | type: "RUNTIME_ERROR", |
| 695 | messages: [ |
| 696 | { |
| 697 | message: errorObject.message, |
| 698 | stack: parseErrorToStacks(errorObject), |
| 699 | }, |
| 700 | ], |
| 701 | }); |
| 702 | } |
| 703 | }; |
| 704 | |
| 705 | listenToRuntimeError((errorEvent) => { |
| 706 | // error property may be empty in older browser like IE |
no test coverage detected
searching dependent graphs…