@grafana/ui
Version:
Grafana Components Library
27 lines (24 loc) • 808 B
JavaScript
import { jsxs, jsx } from 'react/jsx-runtime';
import { css } from '@emotion/css';
import { useStyles2 } from '../../themes/ThemeContext.mjs';
;
const ErrorWithStack = ({ error, errorInfo, title }) => {
const style = useStyles2(getStyles);
return /* @__PURE__ */ jsxs("div", { className: style, children: [
/* @__PURE__ */ jsx("h2", { children: title }),
/* @__PURE__ */ jsxs("details", { style: { whiteSpace: "pre-wrap" }, children: [
error && error.toString(),
/* @__PURE__ */ jsx("br", {}),
errorInfo && errorInfo.componentStack
] })
] });
};
ErrorWithStack.displayName = "ErrorWithStack";
const getStyles = () => {
return css({
width: "500px",
margin: "64px auto"
});
};
export { ErrorWithStack };
//# sourceMappingURL=ErrorWithStack.mjs.map