(arg)
| 2750 | const firstErrorLine = (error) => StringPrototypeSplit(error.message, '\n', 1)[0]; |
| 2751 | let CIRCULAR_ERROR_MESSAGE; |
| 2752 | function tryStringify(arg) { |
| 2753 | try { |
| 2754 | return JSONStringify(arg); |
| 2755 | } catch (err) { |
| 2756 | // Populate the circular error message lazily |
| 2757 | if (!CIRCULAR_ERROR_MESSAGE) { |
| 2758 | try { |
| 2759 | const a = {}; |
| 2760 | a.a = a; |
| 2761 | JSONStringify(a); |
| 2762 | } catch (circularError) { |
| 2763 | CIRCULAR_ERROR_MESSAGE = firstErrorLine(circularError); |
| 2764 | } |
| 2765 | } |
| 2766 | if (err.name === 'TypeError' && |
| 2767 | firstErrorLine(err) === CIRCULAR_ERROR_MESSAGE) { |
| 2768 | return '[Circular]'; |
| 2769 | } |
| 2770 | throw err; |
| 2771 | } |
| 2772 | } |
| 2773 | |
| 2774 | function format(...args) { |
| 2775 | return formatWithOptionsInternal(undefined, args); |
no test coverage detected
searching dependent graphs…