Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const printActualErrorMessage = error => {
if (error) {
const {message, stack} = separateMessageFromStack(error.stack);
return (
'Instead, it threw:\n' +
/* eslint-disable-next-line new-cap */
RECEIVED_COLOR(
` ${message}` +
formatStackTrace(
// remove KaTeX internal stack entries
stack.split('\n')
.filter(line => line.indexOf('new ParseError') === -1)
.join('\n'),
{
rootDir: process.cwd(),
testMatch: [],
},
{
noStackTrace: false,
},
),
)
);
}
return 'But it didn\'t throw anything.';