Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
{diagnostics.map((d, i) => {
let {message, stack, hints, codeframe} = prettyDiagnostic(d);
return (
<div>
{i > 0 ? ' ' : '' /* spacer */}
{`${emoji} `} {message}
{!codeframe && stack && (
<div>
{stack}
</div>
)}
{codeframe && <div>{codeframe}</div>}
{hints.length > 0 && }
</div>
);
function logUncaughtError(e: mixed) {
if (e instanceof ThrowableDiagnostic) {
for (let diagnostic of e.diagnostics) {
let out = prettyDiagnostic(diagnostic);
console.error(out.message);
console.error(out.codeframe || out.stack);
for (let h of out.hints) {
console.error(h);
}
}
} else {
console.error(e);
}
}
let renderedDiagnostics = diagnostics.map(d => prettyDiagnostic(d));