import { capitalize } from 'lodash'; import React, { ReactNode } from "react"; import { wrappable, makeClassNameHelper } from "wdk-client/Utils/ComponentUtils"; import Modal from "wdk-client/Components/Overlays/Modal"; import Icon from "wdk-client/Components/Icon/Icon"; import { UnhandledError } from 'wdk-client/Actions/UnhandledErrorActions'; import ErrorStatus from 'wdk-client/Components/PageStatus/Error'; import { record, string, boolean, arrayOf, objectOf } from 'wdk-client/Utils/Json'; import { Seq } from 'wdk-client/Utils/IterableUtils'; import './UnhandledErrors.scss'; const cx = makeClassNameHelper('UnhandledErrors'); interface Props { errors?: UnhandledError[]; showStackTraces: boolean; clearErrors: () => void; } function UnhandledErrors(props: Props) { const { clearErrors, errors, showStackTraces } = props; const errorsToDisplay = Seq.from(errors || []) // .orderBy(error => error.type) .groupBy(error => error.message) .map(([message, errors]) =>
{errors.map(({ id }) =>
{type.split('-').map(capitalize).join('-')} error ({id})
{getStackTrace(error)}
)}