UNPKG

@mui/internal-docs-infra

Version:

MUI Infra - internal documentation creation tools.

25 lines (24 loc) 795 B
'use client'; var _div, _span; import * as React from 'react'; import { useErrors } from "../useErrors/index.js"; import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime"; export function CodeErrorHandler(_ref) { var errors = _ref.errors; var context = useErrors(); errors = context.errors || errors; if (!errors || errors.length === 0) { return _div || (_div = /*#__PURE__*/_jsx("div", { children: "An error occurred, but details were not provided." })); } return /*#__PURE__*/_jsxs("div", { children: [_span || (_span = /*#__PURE__*/_jsx("span", { children: "Error occurred when highlighting code: " })), errors.map(function (error, index) { return /*#__PURE__*/_jsx("div", { children: error.message }, index); })] }); }