import React, { useState } from 'react'; import { Icon } from 'UI'; import { Button } from 'antd'; import { observer } from 'mobx-react-lite'; import { useStore } from 'App/mstore'; import ErrorFrame from '../ErrorFrame/ErrorFrame'; import { useTranslation } from 'react-i18next'; const docLink = 'https://docs.openreplay.com/deployment/upload-sourcemaps'; interface Props { fetchErrorStackList: any; sourcemapUploaded?: boolean; errorStack?: any; message?: string; error: any; } function ErrorDetails(props: Props) { const { t } = useTranslation(); const { errorStore, sessionStore } = useStore(); const { sessionId } = sessionStore.current; const errorStack = errorStore.instanceTrace; const { error, message = '', sourcemapUploaded = false } = props; const [showRaw, setShowRaw] = useState(false); const firstFunc = errorStack[0] && errorStack[0].function; const openDocs = () => { window.open(docLink, '_blank'); }; return (
{!sourcemapUploaded && (
{t( 'Source maps must be uploaded to OpenReplay to be able to see stack traces.', )}   {t('Learn more.')}
)}

{t('Stacktrace')}

{error.name}
{message}
{showRaw && (
{error.name} :{firstFunc || '?'}
)} {errorStack.map((frame: any, i: any) => (
))}
); } ErrorDetails.displayName = 'ErrorDetails'; export default observer(ErrorDetails);