import React, { useState } from 'react';
import { Icon } from 'UI';
import cn from 'classnames';
import stl from './errorFrame.module.css';
function ErrorFrame({ frame = {}, showRaw, isFirst }) {
const [open, setOpen] = useState(isFirst);
const hasContext = frame.context && frame.context.length > 0;
return (
{ showRaw
? (
at
{ frame.function ? frame.function : '?' }
{' '}
(
{`${frame.filename}:${frame.lineNo}:${frame.colNo}`}
)
)
: (
setOpen(!open)}>
{ frame.absPath }
{ frame.function
&& (
<>
{' in '}
{' '}
{frame.function}
{' '}
>
)}
{' at line '}
{frame.lineNo}
:
{frame.colNo}
{ hasContext
&& (
)}
{ open && hasContext
&& (
{ frame.context.map((i) => (
-
{ i[1].replace(/ /g, '\u00a0') }
))}
)}
)}
);
}
export default ErrorFrame;