import React, { Fragment } from "react" import CodeBlock from '@theme/CodeBlock'; import Admonition from '@theme/Admonition'; import ErrorBoundary from "@docusaurus/ErrorBoundary" import json5 from 'json5'; export interface AIOProps { data: string client?: boolean name: string } const AIOExample = (props: AIOProps) => { const { data, name, client = false } = props; let configObj; // eslint-disable-next-line prefer-const try { configObj = json5.parse(data) as object[]; } catch (e) { console.error(e); return Example component crashed because of error! {e.message} } const configType = client ? 'clients' : 'sources'; configObj = configObj.filter(x => x.configureAs === undefined || x.configureAs === (client ? 'client' : 'source')); configObj = configObj.map(x => ({...x, type: name})); const aio = {[configType]: configObj}; return {JSON.stringify(aio, null, 2)} } const WrappedAIOExample = (props: AIOProps) => { return ( Example component crashed because of error: {error.message}. )} > } export default WrappedAIOExample;
Example component crashed because of error!
Example component crashed because of error: {error.message}.