@grafana/ui
Version:
Grafana Components Library
31 lines (26 loc) • 962 B
JavaScript
;
Object.defineProperty(exports, '__esModule', { value: true });
var jsxRuntime = require('react/jsx-runtime');
var css = require('@emotion/css');
var ThemeContext = require('../../themes/ThemeContext.cjs');
;
const ErrorWithStack = ({ error, errorInfo, title }) => {
const style = ThemeContext.useStyles2(getStyles);
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: style, children: [
/* @__PURE__ */ jsxRuntime.jsx("h2", { children: title }),
/* @__PURE__ */ jsxRuntime.jsxs("details", { style: { whiteSpace: "pre-wrap" }, children: [
error && error.toString(),
/* @__PURE__ */ jsxRuntime.jsx("br", {}),
errorInfo && errorInfo.componentStack
] })
] });
};
ErrorWithStack.displayName = "ErrorWithStack";
const getStyles = () => {
return css.css({
width: "500px",
margin: "64px auto"
});
};
exports.ErrorWithStack = ErrorWithStack;
//# sourceMappingURL=ErrorWithStack.cjs.map