@xyo-network/react-error 2.81.8 → 2.81.10
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/browser/components/ErrorBoundary/ThrownErrorBoundary.d.cts +2 -0
- package/dist/browser/components/ErrorBoundary/ThrownErrorBoundary.d.cts.map +1 -1
- package/dist/browser/components/ErrorBoundary/ThrownErrorBoundary.d.mts +2 -0
- package/dist/browser/components/ErrorBoundary/ThrownErrorBoundary.d.mts.map +1 -1
- package/dist/browser/components/ErrorBoundary/ThrownErrorBoundary.d.ts +2 -0
- package/dist/browser/components/ErrorBoundary/ThrownErrorBoundary.d.ts.map +1 -1
- package/dist/browser/components/ErrorRender/ErrorAlert.d.cts +2 -1
- package/dist/browser/components/ErrorRender/ErrorAlert.d.cts.map +1 -1
- package/dist/browser/components/ErrorRender/ErrorAlert.d.mts +2 -1
- package/dist/browser/components/ErrorRender/ErrorAlert.d.mts.map +1 -1
- package/dist/browser/components/ErrorRender/ErrorAlert.d.ts +2 -1
- package/dist/browser/components/ErrorRender/ErrorAlert.d.ts.map +1 -1
- package/dist/browser/components/ErrorRender/Props.d.cts +1 -0
- package/dist/browser/components/ErrorRender/Props.d.cts.map +1 -1
- package/dist/browser/components/ErrorRender/Props.d.mts +1 -0
- package/dist/browser/components/ErrorRender/Props.d.mts.map +1 -1
- package/dist/browser/components/ErrorRender/Props.d.ts +1 -0
- package/dist/browser/components/ErrorRender/Props.d.ts.map +1 -1
- package/dist/browser/components/ErrorRender/Render.d.cts.map +1 -1
- package/dist/browser/components/ErrorRender/Render.d.mts.map +1 -1
- package/dist/browser/components/ErrorRender/Render.d.ts.map +1 -1
- package/dist/browser/index.cjs +22 -8
- package/dist/browser/index.cjs.map +1 -1
- package/dist/browser/index.js +22 -8
- package/dist/browser/index.js.map +1 -1
- package/dist/neutral/components/ErrorBoundary/ThrownErrorBoundary.d.cts +2 -0
- package/dist/neutral/components/ErrorBoundary/ThrownErrorBoundary.d.cts.map +1 -1
- package/dist/neutral/components/ErrorBoundary/ThrownErrorBoundary.d.mts +2 -0
- package/dist/neutral/components/ErrorBoundary/ThrownErrorBoundary.d.mts.map +1 -1
- package/dist/neutral/components/ErrorBoundary/ThrownErrorBoundary.d.ts +2 -0
- package/dist/neutral/components/ErrorBoundary/ThrownErrorBoundary.d.ts.map +1 -1
- package/dist/neutral/components/ErrorRender/ErrorAlert.d.cts +2 -1
- package/dist/neutral/components/ErrorRender/ErrorAlert.d.cts.map +1 -1
- package/dist/neutral/components/ErrorRender/ErrorAlert.d.mts +2 -1
- package/dist/neutral/components/ErrorRender/ErrorAlert.d.mts.map +1 -1
- package/dist/neutral/components/ErrorRender/ErrorAlert.d.ts +2 -1
- package/dist/neutral/components/ErrorRender/ErrorAlert.d.ts.map +1 -1
- package/dist/neutral/components/ErrorRender/Props.d.cts +1 -0
- package/dist/neutral/components/ErrorRender/Props.d.cts.map +1 -1
- package/dist/neutral/components/ErrorRender/Props.d.mts +1 -0
- package/dist/neutral/components/ErrorRender/Props.d.mts.map +1 -1
- package/dist/neutral/components/ErrorRender/Props.d.ts +1 -0
- package/dist/neutral/components/ErrorRender/Props.d.ts.map +1 -1
- package/dist/neutral/components/ErrorRender/Render.d.cts.map +1 -1
- package/dist/neutral/components/ErrorRender/Render.d.mts.map +1 -1
- package/dist/neutral/components/ErrorRender/Render.d.ts.map +1 -1
- package/dist/neutral/index.cjs +22 -8
- package/dist/neutral/index.cjs.map +1 -1
- package/dist/neutral/index.js +22 -8
- package/dist/neutral/index.js.map +1 -1
- package/dist/node/components/ErrorBoundary/ThrownErrorBoundary.d.cts +2 -0
- package/dist/node/components/ErrorBoundary/ThrownErrorBoundary.d.cts.map +1 -1
- package/dist/node/components/ErrorBoundary/ThrownErrorBoundary.d.mts +2 -0
- package/dist/node/components/ErrorBoundary/ThrownErrorBoundary.d.mts.map +1 -1
- package/dist/node/components/ErrorBoundary/ThrownErrorBoundary.d.ts +2 -0
- package/dist/node/components/ErrorBoundary/ThrownErrorBoundary.d.ts.map +1 -1
- package/dist/node/components/ErrorRender/ErrorAlert.d.cts +2 -1
- package/dist/node/components/ErrorRender/ErrorAlert.d.cts.map +1 -1
- package/dist/node/components/ErrorRender/ErrorAlert.d.mts +2 -1
- package/dist/node/components/ErrorRender/ErrorAlert.d.mts.map +1 -1
- package/dist/node/components/ErrorRender/ErrorAlert.d.ts +2 -1
- package/dist/node/components/ErrorRender/ErrorAlert.d.ts.map +1 -1
- package/dist/node/components/ErrorRender/Props.d.cts +1 -0
- package/dist/node/components/ErrorRender/Props.d.cts.map +1 -1
- package/dist/node/components/ErrorRender/Props.d.mts +1 -0
- package/dist/node/components/ErrorRender/Props.d.mts.map +1 -1
- package/dist/node/components/ErrorRender/Props.d.ts +1 -0
- package/dist/node/components/ErrorRender/Props.d.ts.map +1 -1
- package/dist/node/components/ErrorRender/Render.d.cts.map +1 -1
- package/dist/node/components/ErrorRender/Render.d.mts.map +1 -1
- package/dist/node/components/ErrorRender/Render.d.ts.map +1 -1
- package/dist/node/index.cjs +22 -8
- package/dist/node/index.cjs.map +1 -1
- package/dist/node/index.js +22 -8
- package/dist/node/index.js.map +1 -1
- package/package.json +1 -1
- package/src/components/ErrorBoundary/ThrownErrorBoundary.tsx +4 -2
- package/src/components/ErrorRender/ErrorAlert.stories.tsx +42 -0
- package/src/components/ErrorRender/ErrorAlert.tsx +27 -11
- package/src/components/ErrorRender/Props.ts +1 -0
- package/src/components/ErrorRender/Render.tsx +2 -1
package/dist/neutral/index.cjs
CHANGED
@@ -37,12 +37,25 @@ var import_icons_material = require("@mui/icons-material");
|
|
37
37
|
var import_material = require("@mui/material");
|
38
38
|
var import_react_button = require("@xylabs/react-button");
|
39
39
|
var import_jsx_runtime = require("react/jsx-runtime");
|
40
|
-
var ErrorAlert = ({
|
40
|
+
var ErrorAlert = ({
|
41
|
+
title = "Whoops! Something went wrong",
|
42
|
+
onCancel,
|
43
|
+
error = "An unknown error occurred",
|
44
|
+
errorContext,
|
45
|
+
scope,
|
46
|
+
...props
|
47
|
+
}) => {
|
48
|
+
const finalScope = scope ?? errorContext;
|
41
49
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_material.Alert, { severity: "error", ...props, children: [
|
42
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_material.AlertTitle, { children:
|
43
|
-
|
44
|
-
|
45
|
-
|
50
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_material.AlertTitle, { children: title }),
|
51
|
+
finalScope ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { children: [
|
52
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_material.Typography, { variant: "caption", mr: 0.5, fontWeight: "bold", children: "Scope:" }),
|
53
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_material.Typography, { variant: "caption", children: finalScope })
|
54
|
+
] }) : null,
|
55
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { children: [
|
56
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_material.Typography, { variant: "caption", mr: 0.5, fontWeight: "bold", children: "Error:" }),
|
57
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_material.Typography, { variant: "caption", children: typeof error === "string" ? error : error?.message })
|
58
|
+
] }),
|
46
59
|
onCancel ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_button.ButtonEx, { variant: "outlined", size: "small", onClick: onCancel, position: "absolute", style: { right: 8, top: 8 }, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_icons_material.ExitToApp, { fontSize: "small" }) }) : null
|
47
60
|
] });
|
48
61
|
};
|
@@ -58,6 +71,7 @@ var ErrorRender = ({
|
|
58
71
|
customError = null,
|
59
72
|
children,
|
60
73
|
errorContext,
|
74
|
+
scope,
|
61
75
|
useLocation,
|
62
76
|
...props
|
63
77
|
}) => {
|
@@ -71,7 +85,7 @@ var ErrorRender = ({
|
|
71
85
|
};
|
72
86
|
}
|
73
87
|
}, [location]);
|
74
|
-
return error ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_react_flexbox.FlexCol, { alignItems: "stretch", ...props, children: noErrorDisplay ? customError : /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_react_flexbox.FlexCol, { alignItems: "center", ...props, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(ErrorAlert, { error, errorContext, onCancel }) }) }) : /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_jsx_runtime2.Fragment, { children }) ?? null;
|
88
|
+
return error ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_react_flexbox.FlexCol, { alignItems: "stretch", ...props, children: noErrorDisplay ? customError : /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_react_flexbox.FlexCol, { alignItems: "center", ...props, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(ErrorAlert, { error, errorContext, onCancel, scope }) }) }) : /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_jsx_runtime2.Fragment, { children }) ?? null;
|
75
89
|
};
|
76
90
|
|
77
91
|
// src/components/ErrorBoundary/ThrownErrorBoundary.tsx
|
@@ -97,12 +111,12 @@ var ThrownErrorBoundary = class _ThrownErrorBoundary extends import_react2.Compo
|
|
97
111
|
}
|
98
112
|
render() {
|
99
113
|
const { xyoError } = this.state;
|
100
|
-
const { children, boundaryName, errorComponent } = this.props;
|
114
|
+
const { children, boundaryName, errorComponent, scope, title } = this.props;
|
101
115
|
if (xyoError) {
|
102
116
|
if (errorComponent) {
|
103
117
|
return errorComponent(xyoError);
|
104
118
|
}
|
105
|
-
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(ErrorRender, { error: xyoError, errorContext: `${boundaryName} Boundary
|
119
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(ErrorRender, { error: xyoError, errorContext: `${boundaryName} Boundary`, scope, title });
|
106
120
|
}
|
107
121
|
return children;
|
108
122
|
}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../src/index.ts","../../src/components/ErrorBoundary/ThrownErrorBoundary.tsx","../../src/components/ErrorRender/ErrorAlert.tsx","../../src/components/ErrorRender/Render.tsx","../../src/contexts/ErrorReporter/Provider.tsx","../../src/contexts/ErrorReporter/Context.ts","../../src/contexts/ErrorReporter/useRollbar.tsx"],"sourcesContent":["export * from './components/index.js'\nexport * from './contexts/index.js'\n","import { ModuleError, ModuleErrorSchema } from '@xyo-network/payload-model'\nimport { Component, ErrorInfo, ReactNode } from 'react'\nimport Rollbar from 'rollbar'\n\nimport { ErrorRender } from '../ErrorRender/index.js'\n\nexport interface ThrownErrorBoundaryProps {\n boundaryName?: string\n children: ReactNode\n errorComponent?: (e: ModuleError, boundaryName?: string) => ReactNode\n rethrow?: boolean\n rollbar?: Rollbar\n}\n\nexport interface ThrownErrorBoundaryState {\n xyoError?: ModuleError\n}\n\nexport class ThrownErrorBoundary extends Component<ThrownErrorBoundaryProps, ThrownErrorBoundaryState> {\n override state: ThrownErrorBoundaryState = {\n xyoError: undefined,\n }\n\n static getDerivedStateFromError(error: Error) {\n return { hasError: true, xyoError: ThrownErrorBoundary.normalizeError(error) } as ThrownErrorBoundaryState\n }\n\n static normalizeError(error: Error | ModuleError): ModuleError {\n return (\n (error as ModuleError).schema === ModuleErrorSchema ?\n error\n : { message: error.message, schema: ModuleErrorSchema, sources: [] }) as ModuleError\n }\n\n override componentDidCatch(error: Error, errorInfo: ErrorInfo) {\n const { rethrow, rollbar } = this.props\n const { xyoError } = this.state\n\n rollbar?.error(error)\n\n console.error('Error:', xyoError, errorInfo)\n if (rethrow) {\n throw error\n }\n }\n\n override render() {\n const { xyoError } = this.state\n const { children, boundaryName, errorComponent } = this.props\n if (xyoError) {\n if (errorComponent) {\n return errorComponent(xyoError)\n }\n return <ErrorRender error={xyoError} errorContext={`${boundaryName} Boundary`} />\n }\n\n return children\n }\n}\n","import { ExitToApp as ExitIcon } from '@mui/icons-material'\nimport { Alert, AlertProps, AlertTitle, Typography } from '@mui/material'\nimport { ButtonEx } from '@xylabs/react-button'\nimport { ModuleError } from '@xyo-network/payload-model'\n\nexport interface ErrorAlertProps extends AlertProps {\n error?: ModuleError | Error\n errorContext?: string\n onCancel?: () => void\n}\n\nexport const ErrorAlert: React.FC<ErrorAlertProps> = ({ onCancel
|
1
|
+
{"version":3,"sources":["../../src/index.ts","../../src/components/ErrorBoundary/ThrownErrorBoundary.tsx","../../src/components/ErrorRender/ErrorAlert.tsx","../../src/components/ErrorRender/Render.tsx","../../src/contexts/ErrorReporter/Provider.tsx","../../src/contexts/ErrorReporter/Context.ts","../../src/contexts/ErrorReporter/useRollbar.tsx"],"sourcesContent":["export * from './components/index.js'\nexport * from './contexts/index.js'\n","import { ModuleError, ModuleErrorSchema } from '@xyo-network/payload-model'\nimport { Component, ErrorInfo, ReactNode } from 'react'\nimport Rollbar from 'rollbar'\n\nimport { ErrorRender } from '../ErrorRender/index.js'\n\nexport interface ThrownErrorBoundaryProps {\n boundaryName?: string\n children: ReactNode\n errorComponent?: (e: ModuleError, boundaryName?: string) => ReactNode\n rethrow?: boolean\n rollbar?: Rollbar\n scope?: string\n title?: string\n}\n\nexport interface ThrownErrorBoundaryState {\n xyoError?: ModuleError\n}\n\nexport class ThrownErrorBoundary extends Component<ThrownErrorBoundaryProps, ThrownErrorBoundaryState> {\n override state: ThrownErrorBoundaryState = {\n xyoError: undefined,\n }\n\n static getDerivedStateFromError(error: Error) {\n return { hasError: true, xyoError: ThrownErrorBoundary.normalizeError(error) } as ThrownErrorBoundaryState\n }\n\n static normalizeError(error: Error | ModuleError): ModuleError {\n return (\n (error as ModuleError).schema === ModuleErrorSchema ?\n error\n : { message: error.message, schema: ModuleErrorSchema, sources: [] }) as ModuleError\n }\n\n override componentDidCatch(error: Error, errorInfo: ErrorInfo) {\n const { rethrow, rollbar } = this.props\n const { xyoError } = this.state\n\n rollbar?.error(error)\n\n console.error('Error:', xyoError, errorInfo)\n if (rethrow) {\n throw error\n }\n }\n\n override render() {\n const { xyoError } = this.state\n const { children, boundaryName, errorComponent, scope, title } = this.props\n if (xyoError) {\n if (errorComponent) {\n return errorComponent(xyoError)\n }\n return <ErrorRender error={xyoError} errorContext={`${boundaryName} Boundary`} scope={scope} title={title} />\n }\n\n return children\n }\n}\n","import { ExitToApp as ExitIcon } from '@mui/icons-material'\nimport { Alert, AlertProps, AlertTitle, Typography } from '@mui/material'\nimport { ButtonEx } from '@xylabs/react-button'\nimport { ModuleError } from '@xyo-network/payload-model'\n\nexport interface ErrorAlertProps extends AlertProps {\n error?: ModuleError | Error | string\n /** @deprecated use scope instead */\n errorContext?: string\n onCancel?: () => void\n scope?: string\n}\n\n// eslint-disable-next-line deprecation/deprecation\nexport const ErrorAlert: React.FC<ErrorAlertProps> = ({\n title = 'Whoops! Something went wrong',\n onCancel,\n error = 'An unknown error occurred',\n errorContext,\n scope,\n ...props\n}) => {\n const finalScope = scope ?? errorContext\n return (\n <Alert severity=\"error\" {...props}>\n <AlertTitle>{title}</AlertTitle>\n {finalScope ?\n <div>\n <Typography variant=\"caption\" mr={0.5} fontWeight=\"bold\">\n Scope:\n </Typography>\n <Typography variant=\"caption\">{finalScope}</Typography>\n </div>\n : null}\n <div>\n <Typography variant=\"caption\" mr={0.5} fontWeight=\"bold\">\n Error:\n </Typography>\n <Typography variant=\"caption\">{typeof error === 'string' ? error : error?.message}</Typography>\n </div>\n {onCancel ?\n <ButtonEx variant=\"outlined\" size=\"small\" onClick={onCancel} position=\"absolute\" style={{ right: 8, top: 8 }}>\n <ExitIcon fontSize=\"small\" />\n </ButtonEx>\n : null}\n </Alert>\n )\n}\n","import { FlexCol } from '@xylabs/react-flexbox'\nimport { useEffect } from 'react'\n\nimport { ErrorAlert } from './ErrorAlert.js'\nimport { ErrorRenderProps } from './Props.js'\n\nexport const ErrorRender: React.FC<ErrorRenderProps> = ({\n onCancel,\n error,\n noErrorDisplay = false,\n customError = null,\n children,\n errorContext,\n scope,\n useLocation,\n ...props\n}) => {\n const location = useLocation?.()\n useEffect(() => {\n if (location) {\n // ensure we end up at the same place we are now after logging in\n location.state = {\n from: {\n pathname: window.location.pathname,\n },\n }\n }\n }, [location])\n\n return error ?\n <FlexCol alignItems=\"stretch\" {...props}>\n {noErrorDisplay ?\n customError\n : <FlexCol alignItems=\"center\" {...props}>\n <ErrorAlert error={error} errorContext={errorContext} onCancel={onCancel} scope={scope} />\n </FlexCol>\n }\n </FlexCol>\n : (<>{children}</> ?? null)\n}\n","import { WithChildren } from '@xylabs/react-shared'\nimport { useEffect, useState } from 'react'\nimport Rollbar from 'rollbar'\n\nimport { ErrorReporterContext } from './Context.js'\n\nexport interface ErrorReporterProviderProps {\n rollbar: Rollbar\n}\n\nconst ErrorReporterProvider: React.FC<WithChildren<ErrorReporterProviderProps>> = ({ children, rollbar }) => {\n const [rollbarInstance, setRollBarInstance] = useState<Rollbar>()\n\n useEffect(() => {\n if (rollbarInstance) {\n setRollBarInstance(rollbarInstance)\n }\n }, [rollbar, rollbarInstance])\n\n return <ErrorReporterContext.Provider value={{ rollbar }}>{children}</ErrorReporterContext.Provider>\n}\n\nexport { ErrorReporterProvider }\n","import { createContext } from 'react'\n\nimport { ErrorReporterContextState } from './State.js'\n\nexport const ErrorReporterContext = createContext<ErrorReporterContextState>({})\n","import { useContext } from 'react'\n\nimport { ErrorReporterContext } from './Context.js'\n\nconst useRollbar = () => {\n const context = useContext(ErrorReporterContext)\n if (context === undefined) {\n console.warn('useRollbar must be used within a ErrorReporterContext')\n }\n\n return context ?? {}\n}\n\nexport { useRollbar }\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,2BAA+C;AAC/C,IAAAA,gBAAgD;;;ACDhD,4BAAsC;AACtC,sBAA0D;AAC1D,0BAAyB;AAuBnB;AAXC,IAAM,aAAwC,CAAC;AAAA,EACpD,QAAQ;AAAA,EACR;AAAA,EACA,QAAQ;AAAA,EACR;AAAA,EACA;AAAA,EACA,GAAG;AACL,MAAM;AACJ,QAAM,aAAa,SAAS;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AAC,qBAAqB,UAArB,EAA8B,OAAO,EAAE,QAAQ,GAAI,UAAS;AACtE;;;AEpBA,IAAAC,gBAA2B;AAI3B,IAAM,aAAa,MAAM;AACvB,QAAM,cAAU,0BAAW,oBAAoB;AAC/C,MAAI,YAAY,QAAW;AACzB,YAAQ,KAAK,uDAAuD;AAAA,EACtE;AAEA,SAAO,WAAW,CAAC;AACrB;","names":["import_react","ExitIcon","import_jsx_runtime","import_jsx_runtime","import_react","import_react","import_jsx_runtime","import_react"]}
|
package/dist/neutral/index.js
CHANGED
@@ -7,12 +7,25 @@ import { ExitToApp as ExitIcon } from "@mui/icons-material";
|
|
7
7
|
import { Alert, AlertTitle, Typography } from "@mui/material";
|
8
8
|
import { ButtonEx } from "@xylabs/react-button";
|
9
9
|
import { jsx, jsxs } from "react/jsx-runtime";
|
10
|
-
var ErrorAlert = ({
|
10
|
+
var ErrorAlert = ({
|
11
|
+
title = "Whoops! Something went wrong",
|
12
|
+
onCancel,
|
13
|
+
error = "An unknown error occurred",
|
14
|
+
errorContext,
|
15
|
+
scope,
|
16
|
+
...props
|
17
|
+
}) => {
|
18
|
+
const finalScope = scope ?? errorContext;
|
11
19
|
return /* @__PURE__ */ jsxs(Alert, { severity: "error", ...props, children: [
|
12
|
-
/* @__PURE__ */ jsx(AlertTitle, { children:
|
13
|
-
|
14
|
-
|
15
|
-
|
20
|
+
/* @__PURE__ */ jsx(AlertTitle, { children: title }),
|
21
|
+
finalScope ? /* @__PURE__ */ jsxs("div", { children: [
|
22
|
+
/* @__PURE__ */ jsx(Typography, { variant: "caption", mr: 0.5, fontWeight: "bold", children: "Scope:" }),
|
23
|
+
/* @__PURE__ */ jsx(Typography, { variant: "caption", children: finalScope })
|
24
|
+
] }) : null,
|
25
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
26
|
+
/* @__PURE__ */ jsx(Typography, { variant: "caption", mr: 0.5, fontWeight: "bold", children: "Error:" }),
|
27
|
+
/* @__PURE__ */ jsx(Typography, { variant: "caption", children: typeof error === "string" ? error : error?.message })
|
28
|
+
] }),
|
16
29
|
onCancel ? /* @__PURE__ */ jsx(ButtonEx, { variant: "outlined", size: "small", onClick: onCancel, position: "absolute", style: { right: 8, top: 8 }, children: /* @__PURE__ */ jsx(ExitIcon, { fontSize: "small" }) }) : null
|
17
30
|
] });
|
18
31
|
};
|
@@ -28,6 +41,7 @@ var ErrorRender = ({
|
|
28
41
|
customError = null,
|
29
42
|
children,
|
30
43
|
errorContext,
|
44
|
+
scope,
|
31
45
|
useLocation,
|
32
46
|
...props
|
33
47
|
}) => {
|
@@ -41,7 +55,7 @@ var ErrorRender = ({
|
|
41
55
|
};
|
42
56
|
}
|
43
57
|
}, [location]);
|
44
|
-
return error ? /* @__PURE__ */ jsx2(FlexCol, { alignItems: "stretch", ...props, children: noErrorDisplay ? customError : /* @__PURE__ */ jsx2(FlexCol, { alignItems: "center", ...props, children: /* @__PURE__ */ jsx2(ErrorAlert, { error, errorContext, onCancel }) }) }) : /* @__PURE__ */ jsx2(Fragment, { children }) ?? null;
|
58
|
+
return error ? /* @__PURE__ */ jsx2(FlexCol, { alignItems: "stretch", ...props, children: noErrorDisplay ? customError : /* @__PURE__ */ jsx2(FlexCol, { alignItems: "center", ...props, children: /* @__PURE__ */ jsx2(ErrorAlert, { error, errorContext, onCancel, scope }) }) }) : /* @__PURE__ */ jsx2(Fragment, { children }) ?? null;
|
45
59
|
};
|
46
60
|
|
47
61
|
// src/components/ErrorBoundary/ThrownErrorBoundary.tsx
|
@@ -67,12 +81,12 @@ var ThrownErrorBoundary = class _ThrownErrorBoundary extends Component {
|
|
67
81
|
}
|
68
82
|
render() {
|
69
83
|
const { xyoError } = this.state;
|
70
|
-
const { children, boundaryName, errorComponent } = this.props;
|
84
|
+
const { children, boundaryName, errorComponent, scope, title } = this.props;
|
71
85
|
if (xyoError) {
|
72
86
|
if (errorComponent) {
|
73
87
|
return errorComponent(xyoError);
|
74
88
|
}
|
75
|
-
return /* @__PURE__ */ jsx3(ErrorRender, { error: xyoError, errorContext: `${boundaryName} Boundary
|
89
|
+
return /* @__PURE__ */ jsx3(ErrorRender, { error: xyoError, errorContext: `${boundaryName} Boundary`, scope, title });
|
76
90
|
}
|
77
91
|
return children;
|
78
92
|
}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../src/components/ErrorBoundary/ThrownErrorBoundary.tsx","../../src/components/ErrorRender/ErrorAlert.tsx","../../src/components/ErrorRender/Render.tsx","../../src/contexts/ErrorReporter/Provider.tsx","../../src/contexts/ErrorReporter/Context.ts","../../src/contexts/ErrorReporter/useRollbar.tsx"],"sourcesContent":["import { ModuleError, ModuleErrorSchema } from '@xyo-network/payload-model'\nimport { Component, ErrorInfo, ReactNode } from 'react'\nimport Rollbar from 'rollbar'\n\nimport { ErrorRender } from '../ErrorRender/index.js'\n\nexport interface ThrownErrorBoundaryProps {\n boundaryName?: string\n children: ReactNode\n errorComponent?: (e: ModuleError, boundaryName?: string) => ReactNode\n rethrow?: boolean\n rollbar?: Rollbar\n}\n\nexport interface ThrownErrorBoundaryState {\n xyoError?: ModuleError\n}\n\nexport class ThrownErrorBoundary extends Component<ThrownErrorBoundaryProps, ThrownErrorBoundaryState> {\n override state: ThrownErrorBoundaryState = {\n xyoError: undefined,\n }\n\n static getDerivedStateFromError(error: Error) {\n return { hasError: true, xyoError: ThrownErrorBoundary.normalizeError(error) } as ThrownErrorBoundaryState\n }\n\n static normalizeError(error: Error | ModuleError): ModuleError {\n return (\n (error as ModuleError).schema === ModuleErrorSchema ?\n error\n : { message: error.message, schema: ModuleErrorSchema, sources: [] }) as ModuleError\n }\n\n override componentDidCatch(error: Error, errorInfo: ErrorInfo) {\n const { rethrow, rollbar } = this.props\n const { xyoError } = this.state\n\n rollbar?.error(error)\n\n console.error('Error:', xyoError, errorInfo)\n if (rethrow) {\n throw error\n }\n }\n\n override render() {\n const { xyoError } = this.state\n const { children, boundaryName, errorComponent } = this.props\n if (xyoError) {\n if (errorComponent) {\n return errorComponent(xyoError)\n }\n return <ErrorRender error={xyoError} errorContext={`${boundaryName} Boundary`} />\n }\n\n return children\n }\n}\n","import { ExitToApp as ExitIcon } from '@mui/icons-material'\nimport { Alert, AlertProps, AlertTitle, Typography } from '@mui/material'\nimport { ButtonEx } from '@xylabs/react-button'\nimport { ModuleError } from '@xyo-network/payload-model'\n\nexport interface ErrorAlertProps extends AlertProps {\n error?: ModuleError | Error\n errorContext?: string\n onCancel?: () => void\n}\n\nexport const ErrorAlert: React.FC<ErrorAlertProps> = ({ onCancel
|
1
|
+
{"version":3,"sources":["../../src/components/ErrorBoundary/ThrownErrorBoundary.tsx","../../src/components/ErrorRender/ErrorAlert.tsx","../../src/components/ErrorRender/Render.tsx","../../src/contexts/ErrorReporter/Provider.tsx","../../src/contexts/ErrorReporter/Context.ts","../../src/contexts/ErrorReporter/useRollbar.tsx"],"sourcesContent":["import { ModuleError, ModuleErrorSchema } from '@xyo-network/payload-model'\nimport { Component, ErrorInfo, ReactNode } from 'react'\nimport Rollbar from 'rollbar'\n\nimport { ErrorRender } from '../ErrorRender/index.js'\n\nexport interface ThrownErrorBoundaryProps {\n boundaryName?: string\n children: ReactNode\n errorComponent?: (e: ModuleError, boundaryName?: string) => ReactNode\n rethrow?: boolean\n rollbar?: Rollbar\n scope?: string\n title?: string\n}\n\nexport interface ThrownErrorBoundaryState {\n xyoError?: ModuleError\n}\n\nexport class ThrownErrorBoundary extends Component<ThrownErrorBoundaryProps, ThrownErrorBoundaryState> {\n override state: ThrownErrorBoundaryState = {\n xyoError: undefined,\n }\n\n static getDerivedStateFromError(error: Error) {\n return { hasError: true, xyoError: ThrownErrorBoundary.normalizeError(error) } as ThrownErrorBoundaryState\n }\n\n static normalizeError(error: Error | ModuleError): ModuleError {\n return (\n (error as ModuleError).schema === ModuleErrorSchema ?\n error\n : { message: error.message, schema: ModuleErrorSchema, sources: [] }) as ModuleError\n }\n\n override componentDidCatch(error: Error, errorInfo: ErrorInfo) {\n const { rethrow, rollbar } = this.props\n const { xyoError } = this.state\n\n rollbar?.error(error)\n\n console.error('Error:', xyoError, errorInfo)\n if (rethrow) {\n throw error\n }\n }\n\n override render() {\n const { xyoError } = this.state\n const { children, boundaryName, errorComponent, scope, title } = this.props\n if (xyoError) {\n if (errorComponent) {\n return errorComponent(xyoError)\n }\n return <ErrorRender error={xyoError} errorContext={`${boundaryName} Boundary`} scope={scope} title={title} />\n }\n\n return children\n }\n}\n","import { ExitToApp as ExitIcon } from '@mui/icons-material'\nimport { Alert, AlertProps, AlertTitle, Typography } from '@mui/material'\nimport { ButtonEx } from '@xylabs/react-button'\nimport { ModuleError } from '@xyo-network/payload-model'\n\nexport interface ErrorAlertProps extends AlertProps {\n error?: ModuleError | Error | string\n /** @deprecated use scope instead */\n errorContext?: string\n onCancel?: () => void\n scope?: string\n}\n\n// eslint-disable-next-line deprecation/deprecation\nexport const ErrorAlert: React.FC<ErrorAlertProps> = ({\n title = 'Whoops! Something went wrong',\n onCancel,\n error = 'An unknown error occurred',\n errorContext,\n scope,\n ...props\n}) => {\n const finalScope = scope ?? errorContext\n return (\n <Alert severity=\"error\" {...props}>\n <AlertTitle>{title}</AlertTitle>\n {finalScope ?\n <div>\n <Typography variant=\"caption\" mr={0.5} fontWeight=\"bold\">\n Scope:\n </Typography>\n <Typography variant=\"caption\">{finalScope}</Typography>\n </div>\n : null}\n <div>\n <Typography variant=\"caption\" mr={0.5} fontWeight=\"bold\">\n Error:\n </Typography>\n <Typography variant=\"caption\">{typeof error === 'string' ? error : error?.message}</Typography>\n </div>\n {onCancel ?\n <ButtonEx variant=\"outlined\" size=\"small\" onClick={onCancel} position=\"absolute\" style={{ right: 8, top: 8 }}>\n <ExitIcon fontSize=\"small\" />\n </ButtonEx>\n : null}\n </Alert>\n )\n}\n","import { FlexCol } from '@xylabs/react-flexbox'\nimport { useEffect } from 'react'\n\nimport { ErrorAlert } from './ErrorAlert.js'\nimport { ErrorRenderProps } from './Props.js'\n\nexport const ErrorRender: React.FC<ErrorRenderProps> = ({\n onCancel,\n error,\n noErrorDisplay = false,\n customError = null,\n children,\n errorContext,\n scope,\n useLocation,\n ...props\n}) => {\n const location = useLocation?.()\n useEffect(() => {\n if (location) {\n // ensure we end up at the same place we are now after logging in\n location.state = {\n from: {\n pathname: window.location.pathname,\n },\n }\n }\n }, [location])\n\n return error ?\n <FlexCol alignItems=\"stretch\" {...props}>\n {noErrorDisplay ?\n customError\n : <FlexCol alignItems=\"center\" {...props}>\n <ErrorAlert error={error} errorContext={errorContext} onCancel={onCancel} scope={scope} />\n </FlexCol>\n }\n </FlexCol>\n : (<>{children}</> ?? null)\n}\n","import { WithChildren } from '@xylabs/react-shared'\nimport { useEffect, useState } from 'react'\nimport Rollbar from 'rollbar'\n\nimport { ErrorReporterContext } from './Context.js'\n\nexport interface ErrorReporterProviderProps {\n rollbar: Rollbar\n}\n\nconst ErrorReporterProvider: React.FC<WithChildren<ErrorReporterProviderProps>> = ({ children, rollbar }) => {\n const [rollbarInstance, setRollBarInstance] = useState<Rollbar>()\n\n useEffect(() => {\n if (rollbarInstance) {\n setRollBarInstance(rollbarInstance)\n }\n }, [rollbar, rollbarInstance])\n\n return <ErrorReporterContext.Provider value={{ rollbar }}>{children}</ErrorReporterContext.Provider>\n}\n\nexport { ErrorReporterProvider }\n","import { createContext } from 'react'\n\nimport { ErrorReporterContextState } from './State.js'\n\nexport const ErrorReporterContext = createContext<ErrorReporterContextState>({})\n","import { useContext } from 'react'\n\nimport { ErrorReporterContext } from './Context.js'\n\nconst useRollbar = () => {\n const context = useContext(ErrorReporterContext)\n if (context === undefined) {\n console.warn('useRollbar must be used within a ErrorReporterContext')\n }\n\n return context ?? {}\n}\n\nexport { useRollbar }\n"],"mappings":";AAAA,SAAsB,yBAAyB;AAC/C,SAAS,iBAAuC;;;ACDhD,SAAS,aAAa,gBAAgB;AACtC,SAAS,OAAmB,YAAY,kBAAkB;AAC1D,SAAS,gBAAgB;AAuBnB,cAEE,YAFF;AAXC,IAAM,aAAwC,CAAC;AAA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C,iBAAiB,kBAAkB,IAAI,SAAkB;AAEhE,EAAAC,WAAU,MAAM;AACd,QAAI,iBAAiB;AACnB,yBAAmB,eAAe;AAAA,IACpC;AAAA,EACF,GAAG,CAAC,SAAS,eAAe,CAAC;AAE7B,SAAO,gBAAAD,KAAC,qBAAqB,UAArB,EAA8B,OAAO,EAAE,QAAQ,GAAI,UAAS;AACtE;;;AEpBA,SAAS,kBAAkB;AAI3B,IAAM,aAAa,MAAM;AACvB,QAAM,UAAU,WAAW,oBAAoB;AAC/C,MAAI,YAAY,QAAW;AACzB,YAAQ,KAAK,uDAAuD;AAAA,EACtE;AAEA,SAAO,WAAW,CAAC;AACrB;","names":["jsx","jsx","useEffect","jsx","useEffect"]}
|
@@ -7,6 +7,8 @@ export interface ThrownErrorBoundaryProps {
|
|
7
7
|
errorComponent?: (e: ModuleError, boundaryName?: string) => ReactNode;
|
8
8
|
rethrow?: boolean;
|
9
9
|
rollbar?: Rollbar;
|
10
|
+
scope?: string;
|
11
|
+
title?: string;
|
10
12
|
}
|
11
13
|
export interface ThrownErrorBoundaryState {
|
12
14
|
xyoError?: ModuleError;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"ThrownErrorBoundary.d.ts","sourceRoot":"","sources":["../../../../src/components/ErrorBoundary/ThrownErrorBoundary.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAqB,MAAM,4BAA4B,CAAA;AAC3E,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AACvD,OAAO,OAAO,MAAM,SAAS,CAAA;AAI7B,MAAM,WAAW,wBAAwB;IACvC,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,QAAQ,EAAE,SAAS,CAAA;IACnB,cAAc,CAAC,EAAE,CAAC,CAAC,EAAE,WAAW,EAAE,YAAY,CAAC,EAAE,MAAM,KAAK,SAAS,CAAA;IACrE,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,OAAO,CAAC,EAAE,OAAO,CAAA;
|
1
|
+
{"version":3,"file":"ThrownErrorBoundary.d.ts","sourceRoot":"","sources":["../../../../src/components/ErrorBoundary/ThrownErrorBoundary.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAqB,MAAM,4BAA4B,CAAA;AAC3E,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AACvD,OAAO,OAAO,MAAM,SAAS,CAAA;AAI7B,MAAM,WAAW,wBAAwB;IACvC,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,QAAQ,EAAE,SAAS,CAAA;IACnB,cAAc,CAAC,EAAE,CAAC,CAAC,EAAE,WAAW,EAAE,YAAY,CAAC,EAAE,MAAM,KAAK,SAAS,CAAA;IACrE,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,KAAK,CAAC,EAAE,MAAM,CAAA;CACf;AAED,MAAM,WAAW,wBAAwB;IACvC,QAAQ,CAAC,EAAE,WAAW,CAAA;CACvB;AAED,qBAAa,mBAAoB,SAAQ,SAAS,CAAC,wBAAwB,EAAE,wBAAwB,CAAC;IAC3F,KAAK,EAAE,wBAAwB,CAEvC;IAED,MAAM,CAAC,wBAAwB,CAAC,KAAK,EAAE,KAAK,GACwC,wBAAwB;IAG5G,MAAM,CAAC,cAAc,CAAC,KAAK,EAAE,KAAK,GAAG,WAAW,GAAG,WAAW;IAOrD,iBAAiB,CAAC,KAAK,EAAE,KAAK,EAAE,SAAS,EAAE,SAAS;IAYpD,MAAM;CAYhB"}
|
@@ -7,6 +7,8 @@ export interface ThrownErrorBoundaryProps {
|
|
7
7
|
errorComponent?: (e: ModuleError, boundaryName?: string) => ReactNode;
|
8
8
|
rethrow?: boolean;
|
9
9
|
rollbar?: Rollbar;
|
10
|
+
scope?: string;
|
11
|
+
title?: string;
|
10
12
|
}
|
11
13
|
export interface ThrownErrorBoundaryState {
|
12
14
|
xyoError?: ModuleError;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"ThrownErrorBoundary.d.ts","sourceRoot":"","sources":["../../../../src/components/ErrorBoundary/ThrownErrorBoundary.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAqB,MAAM,4BAA4B,CAAA;AAC3E,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AACvD,OAAO,OAAO,MAAM,SAAS,CAAA;AAI7B,MAAM,WAAW,wBAAwB;IACvC,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,QAAQ,EAAE,SAAS,CAAA;IACnB,cAAc,CAAC,EAAE,CAAC,CAAC,EAAE,WAAW,EAAE,YAAY,CAAC,EAAE,MAAM,KAAK,SAAS,CAAA;IACrE,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,OAAO,CAAC,EAAE,OAAO,CAAA;
|
1
|
+
{"version":3,"file":"ThrownErrorBoundary.d.ts","sourceRoot":"","sources":["../../../../src/components/ErrorBoundary/ThrownErrorBoundary.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAqB,MAAM,4BAA4B,CAAA;AAC3E,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AACvD,OAAO,OAAO,MAAM,SAAS,CAAA;AAI7B,MAAM,WAAW,wBAAwB;IACvC,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,QAAQ,EAAE,SAAS,CAAA;IACnB,cAAc,CAAC,EAAE,CAAC,CAAC,EAAE,WAAW,EAAE,YAAY,CAAC,EAAE,MAAM,KAAK,SAAS,CAAA;IACrE,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,KAAK,CAAC,EAAE,MAAM,CAAA;CACf;AAED,MAAM,WAAW,wBAAwB;IACvC,QAAQ,CAAC,EAAE,WAAW,CAAA;CACvB;AAED,qBAAa,mBAAoB,SAAQ,SAAS,CAAC,wBAAwB,EAAE,wBAAwB,CAAC;IAC3F,KAAK,EAAE,wBAAwB,CAEvC;IAED,MAAM,CAAC,wBAAwB,CAAC,KAAK,EAAE,KAAK,GACwC,wBAAwB;IAG5G,MAAM,CAAC,cAAc,CAAC,KAAK,EAAE,KAAK,GAAG,WAAW,GAAG,WAAW;IAOrD,iBAAiB,CAAC,KAAK,EAAE,KAAK,EAAE,SAAS,EAAE,SAAS;IAYpD,MAAM;CAYhB"}
|
@@ -7,6 +7,8 @@ export interface ThrownErrorBoundaryProps {
|
|
7
7
|
errorComponent?: (e: ModuleError, boundaryName?: string) => ReactNode;
|
8
8
|
rethrow?: boolean;
|
9
9
|
rollbar?: Rollbar;
|
10
|
+
scope?: string;
|
11
|
+
title?: string;
|
10
12
|
}
|
11
13
|
export interface ThrownErrorBoundaryState {
|
12
14
|
xyoError?: ModuleError;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"ThrownErrorBoundary.d.ts","sourceRoot":"","sources":["../../../../src/components/ErrorBoundary/ThrownErrorBoundary.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAqB,MAAM,4BAA4B,CAAA;AAC3E,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AACvD,OAAO,OAAO,MAAM,SAAS,CAAA;AAI7B,MAAM,WAAW,wBAAwB;IACvC,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,QAAQ,EAAE,SAAS,CAAA;IACnB,cAAc,CAAC,EAAE,CAAC,CAAC,EAAE,WAAW,EAAE,YAAY,CAAC,EAAE,MAAM,KAAK,SAAS,CAAA;IACrE,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,OAAO,CAAC,EAAE,OAAO,CAAA;
|
1
|
+
{"version":3,"file":"ThrownErrorBoundary.d.ts","sourceRoot":"","sources":["../../../../src/components/ErrorBoundary/ThrownErrorBoundary.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAqB,MAAM,4BAA4B,CAAA;AAC3E,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AACvD,OAAO,OAAO,MAAM,SAAS,CAAA;AAI7B,MAAM,WAAW,wBAAwB;IACvC,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,QAAQ,EAAE,SAAS,CAAA;IACnB,cAAc,CAAC,EAAE,CAAC,CAAC,EAAE,WAAW,EAAE,YAAY,CAAC,EAAE,MAAM,KAAK,SAAS,CAAA;IACrE,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,KAAK,CAAC,EAAE,MAAM,CAAA;CACf;AAED,MAAM,WAAW,wBAAwB;IACvC,QAAQ,CAAC,EAAE,WAAW,CAAA;CACvB;AAED,qBAAa,mBAAoB,SAAQ,SAAS,CAAC,wBAAwB,EAAE,wBAAwB,CAAC;IAC3F,KAAK,EAAE,wBAAwB,CAEvC;IAED,MAAM,CAAC,wBAAwB,CAAC,KAAK,EAAE,KAAK,GACwC,wBAAwB;IAG5G,MAAM,CAAC,cAAc,CAAC,KAAK,EAAE,KAAK,GAAG,WAAW,GAAG,WAAW;IAOrD,iBAAiB,CAAC,KAAK,EAAE,KAAK,EAAE,SAAS,EAAE,SAAS;IAYpD,MAAM;CAYhB"}
|
@@ -1,9 +1,10 @@
|
|
1
1
|
import { AlertProps } from '@mui/material';
|
2
2
|
import { ModuleError } from '@xyo-network/payload-model';
|
3
3
|
export interface ErrorAlertProps extends AlertProps {
|
4
|
-
error?: ModuleError | Error;
|
4
|
+
error?: ModuleError | Error | string;
|
5
5
|
errorContext?: string;
|
6
6
|
onCancel?: () => void;
|
7
|
+
scope?: string;
|
7
8
|
}
|
8
9
|
export declare const ErrorAlert: React.FC<ErrorAlertProps>;
|
9
10
|
//# sourceMappingURL=ErrorAlert.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"ErrorAlert.d.ts","sourceRoot":"","sources":["../../../../src/components/ErrorRender/ErrorAlert.tsx"],"names":[],"mappings":"AACA,OAAO,EAAS,UAAU,EAA0B,MAAM,eAAe,CAAA;AAEzE,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAA;AAExD,MAAM,WAAW,eAAgB,SAAQ,UAAU;IACjD,KAAK,CAAC,EAAE,WAAW,GAAG,KAAK,CAAA;
|
1
|
+
{"version":3,"file":"ErrorAlert.d.ts","sourceRoot":"","sources":["../../../../src/components/ErrorRender/ErrorAlert.tsx"],"names":[],"mappings":"AACA,OAAO,EAAS,UAAU,EAA0B,MAAM,eAAe,CAAA;AAEzE,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAA;AAExD,MAAM,WAAW,eAAgB,SAAQ,UAAU;IACjD,KAAK,CAAC,EAAE,WAAW,GAAG,KAAK,GAAG,MAAM,CAAA;IAEpC,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAA;IACrB,KAAK,CAAC,EAAE,MAAM,CAAA;CACf;AAGD,eAAO,MAAM,UAAU,EAAE,KAAK,CAAC,EAAE,CAAC,eAAe,CAiChD,CAAA"}
|
@@ -1,9 +1,10 @@
|
|
1
1
|
import { AlertProps } from '@mui/material';
|
2
2
|
import { ModuleError } from '@xyo-network/payload-model';
|
3
3
|
export interface ErrorAlertProps extends AlertProps {
|
4
|
-
error?: ModuleError | Error;
|
4
|
+
error?: ModuleError | Error | string;
|
5
5
|
errorContext?: string;
|
6
6
|
onCancel?: () => void;
|
7
|
+
scope?: string;
|
7
8
|
}
|
8
9
|
export declare const ErrorAlert: React.FC<ErrorAlertProps>;
|
9
10
|
//# sourceMappingURL=ErrorAlert.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"ErrorAlert.d.ts","sourceRoot":"","sources":["../../../../src/components/ErrorRender/ErrorAlert.tsx"],"names":[],"mappings":"AACA,OAAO,EAAS,UAAU,EAA0B,MAAM,eAAe,CAAA;AAEzE,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAA;AAExD,MAAM,WAAW,eAAgB,SAAQ,UAAU;IACjD,KAAK,CAAC,EAAE,WAAW,GAAG,KAAK,CAAA;
|
1
|
+
{"version":3,"file":"ErrorAlert.d.ts","sourceRoot":"","sources":["../../../../src/components/ErrorRender/ErrorAlert.tsx"],"names":[],"mappings":"AACA,OAAO,EAAS,UAAU,EAA0B,MAAM,eAAe,CAAA;AAEzE,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAA;AAExD,MAAM,WAAW,eAAgB,SAAQ,UAAU;IACjD,KAAK,CAAC,EAAE,WAAW,GAAG,KAAK,GAAG,MAAM,CAAA;IAEpC,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAA;IACrB,KAAK,CAAC,EAAE,MAAM,CAAA;CACf;AAGD,eAAO,MAAM,UAAU,EAAE,KAAK,CAAC,EAAE,CAAC,eAAe,CAiChD,CAAA"}
|
@@ -1,9 +1,10 @@
|
|
1
1
|
import { AlertProps } from '@mui/material';
|
2
2
|
import { ModuleError } from '@xyo-network/payload-model';
|
3
3
|
export interface ErrorAlertProps extends AlertProps {
|
4
|
-
error?: ModuleError | Error;
|
4
|
+
error?: ModuleError | Error | string;
|
5
5
|
errorContext?: string;
|
6
6
|
onCancel?: () => void;
|
7
|
+
scope?: string;
|
7
8
|
}
|
8
9
|
export declare const ErrorAlert: React.FC<ErrorAlertProps>;
|
9
10
|
//# sourceMappingURL=ErrorAlert.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"ErrorAlert.d.ts","sourceRoot":"","sources":["../../../../src/components/ErrorRender/ErrorAlert.tsx"],"names":[],"mappings":"AACA,OAAO,EAAS,UAAU,EAA0B,MAAM,eAAe,CAAA;AAEzE,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAA;AAExD,MAAM,WAAW,eAAgB,SAAQ,UAAU;IACjD,KAAK,CAAC,EAAE,WAAW,GAAG,KAAK,CAAA;
|
1
|
+
{"version":3,"file":"ErrorAlert.d.ts","sourceRoot":"","sources":["../../../../src/components/ErrorRender/ErrorAlert.tsx"],"names":[],"mappings":"AACA,OAAO,EAAS,UAAU,EAA0B,MAAM,eAAe,CAAA;AAEzE,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAA;AAExD,MAAM,WAAW,eAAgB,SAAQ,UAAU;IACjD,KAAK,CAAC,EAAE,WAAW,GAAG,KAAK,GAAG,MAAM,CAAA;IAEpC,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAA;IACrB,KAAK,CAAC,EAAE,MAAM,CAAA;CACf;AAGD,eAAO,MAAM,UAAU,EAAE,KAAK,CAAC,EAAE,CAAC,eAAe,CAiChD,CAAA"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"Props.d.ts","sourceRoot":"","sources":["../../../../src/components/ErrorRender/Props.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAA;AACpD,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAA;AACxD,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AACjC,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAA;AAE3C,MAAM,WAAW,gBAAiB,SAAQ,YAAY;IACpD,WAAW,CAAC,EAAE,SAAS,CAAA;IACvB,KAAK,CAAC,EAAE,WAAW,GAAG,KAAK,CAAA;IAC3B,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,cAAc,CAAC,EAAE,OAAO,CAAA;IACxB,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAA;IACrB,WAAW,CAAC,EAAE,MAAM,QAAQ,CAAA;CAC7B"}
|
1
|
+
{"version":3,"file":"Props.d.ts","sourceRoot":"","sources":["../../../../src/components/ErrorRender/Props.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAA;AACpD,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAA;AACxD,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AACjC,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAA;AAE3C,MAAM,WAAW,gBAAiB,SAAQ,YAAY;IACpD,WAAW,CAAC,EAAE,SAAS,CAAA;IACvB,KAAK,CAAC,EAAE,WAAW,GAAG,KAAK,CAAA;IAC3B,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,cAAc,CAAC,EAAE,OAAO,CAAA;IACxB,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAA;IACrB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,WAAW,CAAC,EAAE,MAAM,QAAQ,CAAA;CAC7B"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"Props.d.ts","sourceRoot":"","sources":["../../../../src/components/ErrorRender/Props.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAA;AACpD,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAA;AACxD,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AACjC,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAA;AAE3C,MAAM,WAAW,gBAAiB,SAAQ,YAAY;IACpD,WAAW,CAAC,EAAE,SAAS,CAAA;IACvB,KAAK,CAAC,EAAE,WAAW,GAAG,KAAK,CAAA;IAC3B,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,cAAc,CAAC,EAAE,OAAO,CAAA;IACxB,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAA;IACrB,WAAW,CAAC,EAAE,MAAM,QAAQ,CAAA;CAC7B"}
|
1
|
+
{"version":3,"file":"Props.d.ts","sourceRoot":"","sources":["../../../../src/components/ErrorRender/Props.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAA;AACpD,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAA;AACxD,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AACjC,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAA;AAE3C,MAAM,WAAW,gBAAiB,SAAQ,YAAY;IACpD,WAAW,CAAC,EAAE,SAAS,CAAA;IACvB,KAAK,CAAC,EAAE,WAAW,GAAG,KAAK,CAAA;IAC3B,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,cAAc,CAAC,EAAE,OAAO,CAAA;IACxB,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAA;IACrB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,WAAW,CAAC,EAAE,MAAM,QAAQ,CAAA;CAC7B"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"Props.d.ts","sourceRoot":"","sources":["../../../../src/components/ErrorRender/Props.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAA;AACpD,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAA;AACxD,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AACjC,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAA;AAE3C,MAAM,WAAW,gBAAiB,SAAQ,YAAY;IACpD,WAAW,CAAC,EAAE,SAAS,CAAA;IACvB,KAAK,CAAC,EAAE,WAAW,GAAG,KAAK,CAAA;IAC3B,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,cAAc,CAAC,EAAE,OAAO,CAAA;IACxB,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAA;IACrB,WAAW,CAAC,EAAE,MAAM,QAAQ,CAAA;CAC7B"}
|
1
|
+
{"version":3,"file":"Props.d.ts","sourceRoot":"","sources":["../../../../src/components/ErrorRender/Props.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAA;AACpD,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAA;AACxD,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AACjC,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAA;AAE3C,MAAM,WAAW,gBAAiB,SAAQ,YAAY;IACpD,WAAW,CAAC,EAAE,SAAS,CAAA;IACvB,KAAK,CAAC,EAAE,WAAW,GAAG,KAAK,CAAA;IAC3B,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,cAAc,CAAC,EAAE,OAAO,CAAA;IACxB,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAA;IACrB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,WAAW,CAAC,EAAE,MAAM,QAAQ,CAAA;CAC7B"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"Render.d.ts","sourceRoot":"","sources":["../../../../src/components/ErrorRender/Render.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAA;AAE7C,eAAO,MAAM,WAAW,EAAE,KAAK,CAAC,EAAE,CAAC,gBAAgB,
|
1
|
+
{"version":3,"file":"Render.d.ts","sourceRoot":"","sources":["../../../../src/components/ErrorRender/Render.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAA;AAE7C,eAAO,MAAM,WAAW,EAAE,KAAK,CAAC,EAAE,CAAC,gBAAgB,CAiClD,CAAA"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"Render.d.ts","sourceRoot":"","sources":["../../../../src/components/ErrorRender/Render.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAA;AAE7C,eAAO,MAAM,WAAW,EAAE,KAAK,CAAC,EAAE,CAAC,gBAAgB,
|
1
|
+
{"version":3,"file":"Render.d.ts","sourceRoot":"","sources":["../../../../src/components/ErrorRender/Render.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAA;AAE7C,eAAO,MAAM,WAAW,EAAE,KAAK,CAAC,EAAE,CAAC,gBAAgB,CAiClD,CAAA"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"Render.d.ts","sourceRoot":"","sources":["../../../../src/components/ErrorRender/Render.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAA;AAE7C,eAAO,MAAM,WAAW,EAAE,KAAK,CAAC,EAAE,CAAC,gBAAgB,
|
1
|
+
{"version":3,"file":"Render.d.ts","sourceRoot":"","sources":["../../../../src/components/ErrorRender/Render.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAA;AAE7C,eAAO,MAAM,WAAW,EAAE,KAAK,CAAC,EAAE,CAAC,gBAAgB,CAiClD,CAAA"}
|
package/dist/node/index.cjs
CHANGED
@@ -37,12 +37,25 @@ var import_icons_material = require("@mui/icons-material");
|
|
37
37
|
var import_material = require("@mui/material");
|
38
38
|
var import_react_button = require("@xylabs/react-button");
|
39
39
|
var import_jsx_runtime = require("react/jsx-runtime");
|
40
|
-
var ErrorAlert = ({
|
40
|
+
var ErrorAlert = ({
|
41
|
+
title = "Whoops! Something went wrong",
|
42
|
+
onCancel,
|
43
|
+
error = "An unknown error occurred",
|
44
|
+
errorContext,
|
45
|
+
scope,
|
46
|
+
...props
|
47
|
+
}) => {
|
48
|
+
const finalScope = scope ?? errorContext;
|
41
49
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_material.Alert, { severity: "error", ...props, children: [
|
42
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_material.AlertTitle, { children:
|
43
|
-
|
44
|
-
|
45
|
-
|
50
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_material.AlertTitle, { children: title }),
|
51
|
+
finalScope ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { children: [
|
52
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_material.Typography, { variant: "caption", mr: 0.5, fontWeight: "bold", children: "Scope:" }),
|
53
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_material.Typography, { variant: "caption", children: finalScope })
|
54
|
+
] }) : null,
|
55
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { children: [
|
56
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_material.Typography, { variant: "caption", mr: 0.5, fontWeight: "bold", children: "Error:" }),
|
57
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_material.Typography, { variant: "caption", children: typeof error === "string" ? error : error == null ? void 0 : error.message })
|
58
|
+
] }),
|
46
59
|
onCancel ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_button.ButtonEx, { variant: "outlined", size: "small", onClick: onCancel, position: "absolute", style: { right: 8, top: 8 }, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_icons_material.ExitToApp, { fontSize: "small" }) }) : null
|
47
60
|
] });
|
48
61
|
};
|
@@ -58,6 +71,7 @@ var ErrorRender = ({
|
|
58
71
|
customError = null,
|
59
72
|
children,
|
60
73
|
errorContext,
|
74
|
+
scope,
|
61
75
|
useLocation,
|
62
76
|
...props
|
63
77
|
}) => {
|
@@ -71,7 +85,7 @@ var ErrorRender = ({
|
|
71
85
|
};
|
72
86
|
}
|
73
87
|
}, [location]);
|
74
|
-
return error ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_react_flexbox.FlexCol, { alignItems: "stretch", ...props, children: noErrorDisplay ? customError : /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_react_flexbox.FlexCol, { alignItems: "center", ...props, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(ErrorAlert, { error, errorContext, onCancel }) }) }) : /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_jsx_runtime2.Fragment, { children }) ?? null;
|
88
|
+
return error ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_react_flexbox.FlexCol, { alignItems: "stretch", ...props, children: noErrorDisplay ? customError : /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_react_flexbox.FlexCol, { alignItems: "center", ...props, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(ErrorAlert, { error, errorContext, onCancel, scope }) }) }) : /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_jsx_runtime2.Fragment, { children }) ?? null;
|
75
89
|
};
|
76
90
|
|
77
91
|
// src/components/ErrorBoundary/ThrownErrorBoundary.tsx
|
@@ -97,12 +111,12 @@ var ThrownErrorBoundary = class _ThrownErrorBoundary extends import_react2.Compo
|
|
97
111
|
}
|
98
112
|
render() {
|
99
113
|
const { xyoError } = this.state;
|
100
|
-
const { children, boundaryName, errorComponent } = this.props;
|
114
|
+
const { children, boundaryName, errorComponent, scope, title } = this.props;
|
101
115
|
if (xyoError) {
|
102
116
|
if (errorComponent) {
|
103
117
|
return errorComponent(xyoError);
|
104
118
|
}
|
105
|
-
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(ErrorRender, { error: xyoError, errorContext: `${boundaryName} Boundary
|
119
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(ErrorRender, { error: xyoError, errorContext: `${boundaryName} Boundary`, scope, title });
|
106
120
|
}
|
107
121
|
return children;
|
108
122
|
}
|
package/dist/node/index.cjs.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../src/index.ts","../../src/components/ErrorBoundary/ThrownErrorBoundary.tsx","../../src/components/ErrorRender/ErrorAlert.tsx","../../src/components/ErrorRender/Render.tsx","../../src/contexts/ErrorReporter/Provider.tsx","../../src/contexts/ErrorReporter/Context.ts","../../src/contexts/ErrorReporter/useRollbar.tsx"],"sourcesContent":["export * from './components/index.js'\nexport * from './contexts/index.js'\n","import { ModuleError, ModuleErrorSchema } from '@xyo-network/payload-model'\nimport { Component, ErrorInfo, ReactNode } from 'react'\nimport Rollbar from 'rollbar'\n\nimport { ErrorRender } from '../ErrorRender/index.js'\n\nexport interface ThrownErrorBoundaryProps {\n boundaryName?: string\n children: ReactNode\n errorComponent?: (e: ModuleError, boundaryName?: string) => ReactNode\n rethrow?: boolean\n rollbar?: Rollbar\n}\n\nexport interface ThrownErrorBoundaryState {\n xyoError?: ModuleError\n}\n\nexport class ThrownErrorBoundary extends Component<ThrownErrorBoundaryProps, ThrownErrorBoundaryState> {\n override state: ThrownErrorBoundaryState = {\n xyoError: undefined,\n }\n\n static getDerivedStateFromError(error: Error) {\n return { hasError: true, xyoError: ThrownErrorBoundary.normalizeError(error) } as ThrownErrorBoundaryState\n }\n\n static normalizeError(error: Error | ModuleError): ModuleError {\n return (\n (error as ModuleError).schema === ModuleErrorSchema ?\n error\n : { message: error.message, schema: ModuleErrorSchema, sources: [] }) as ModuleError\n }\n\n override componentDidCatch(error: Error, errorInfo: ErrorInfo) {\n const { rethrow, rollbar } = this.props\n const { xyoError } = this.state\n\n rollbar?.error(error)\n\n console.error('Error:', xyoError, errorInfo)\n if (rethrow) {\n throw error\n }\n }\n\n override render() {\n const { xyoError } = this.state\n const { children, boundaryName, errorComponent } = this.props\n if (xyoError) {\n if (errorComponent) {\n return errorComponent(xyoError)\n }\n return <ErrorRender error={xyoError} errorContext={`${boundaryName} Boundary`} />\n }\n\n return children\n }\n}\n","import { ExitToApp as ExitIcon } from '@mui/icons-material'\nimport { Alert, AlertProps, AlertTitle, Typography } from '@mui/material'\nimport { ButtonEx } from '@xylabs/react-button'\nimport { ModuleError } from '@xyo-network/payload-model'\n\nexport interface ErrorAlertProps extends AlertProps {\n error?: ModuleError | Error\n errorContext?: string\n onCancel?: () => void\n}\n\nexport const ErrorAlert: React.FC<ErrorAlertProps> = ({ onCancel
|
1
|
+
{"version":3,"sources":["../../src/index.ts","../../src/components/ErrorBoundary/ThrownErrorBoundary.tsx","../../src/components/ErrorRender/ErrorAlert.tsx","../../src/components/ErrorRender/Render.tsx","../../src/contexts/ErrorReporter/Provider.tsx","../../src/contexts/ErrorReporter/Context.ts","../../src/contexts/ErrorReporter/useRollbar.tsx"],"sourcesContent":["export * from './components/index.js'\nexport * from './contexts/index.js'\n","import { ModuleError, ModuleErrorSchema } from '@xyo-network/payload-model'\nimport { Component, ErrorInfo, ReactNode } from 'react'\nimport Rollbar from 'rollbar'\n\nimport { ErrorRender } from '../ErrorRender/index.js'\n\nexport interface ThrownErrorBoundaryProps {\n boundaryName?: string\n children: ReactNode\n errorComponent?: (e: ModuleError, boundaryName?: string) => ReactNode\n rethrow?: boolean\n rollbar?: Rollbar\n scope?: string\n title?: string\n}\n\nexport interface ThrownErrorBoundaryState {\n xyoError?: ModuleError\n}\n\nexport class ThrownErrorBoundary extends Component<ThrownErrorBoundaryProps, ThrownErrorBoundaryState> {\n override state: ThrownErrorBoundaryState = {\n xyoError: undefined,\n }\n\n static getDerivedStateFromError(error: Error) {\n return { hasError: true, xyoError: ThrownErrorBoundary.normalizeError(error) } as ThrownErrorBoundaryState\n }\n\n static normalizeError(error: Error | ModuleError): ModuleError {\n return (\n (error as ModuleError).schema === ModuleErrorSchema ?\n error\n : { message: error.message, schema: ModuleErrorSchema, sources: [] }) as ModuleError\n }\n\n override componentDidCatch(error: Error, errorInfo: ErrorInfo) {\n const { rethrow, rollbar } = this.props\n const { xyoError } = this.state\n\n rollbar?.error(error)\n\n console.error('Error:', xyoError, errorInfo)\n if (rethrow) {\n throw error\n }\n }\n\n override render() {\n const { xyoError } = this.state\n const { children, boundaryName, errorComponent, scope, title } = this.props\n if (xyoError) {\n if (errorComponent) {\n return errorComponent(xyoError)\n }\n return <ErrorRender error={xyoError} errorContext={`${boundaryName} Boundary`} scope={scope} title={title} />\n }\n\n return children\n }\n}\n","import { ExitToApp as ExitIcon } from '@mui/icons-material'\nimport { Alert, AlertProps, AlertTitle, Typography } from '@mui/material'\nimport { ButtonEx } from '@xylabs/react-button'\nimport { ModuleError } from '@xyo-network/payload-model'\n\nexport interface ErrorAlertProps extends AlertProps {\n error?: ModuleError | Error | string\n /** @deprecated use scope instead */\n errorContext?: string\n onCancel?: () => void\n scope?: string\n}\n\n// eslint-disable-next-line deprecation/deprecation\nexport const ErrorAlert: React.FC<ErrorAlertProps> = ({\n title = 'Whoops! Something went wrong',\n onCancel,\n error = 'An unknown error occurred',\n errorContext,\n scope,\n ...props\n}) => {\n const finalScope = scope ?? errorContext\n return (\n <Alert severity=\"error\" {...props}>\n <AlertTitle>{title}</AlertTitle>\n {finalScope ?\n <div>\n <Typography variant=\"caption\" mr={0.5} fontWeight=\"bold\">\n Scope:\n </Typography>\n <Typography variant=\"caption\">{finalScope}</Typography>\n </div>\n : null}\n <div>\n <Typography variant=\"caption\" mr={0.5} fontWeight=\"bold\">\n Error:\n </Typography>\n <Typography variant=\"caption\">{typeof error === 'string' ? error : error?.message}</Typography>\n </div>\n {onCancel ?\n <ButtonEx variant=\"outlined\" size=\"small\" onClick={onCancel} position=\"absolute\" style={{ right: 8, top: 8 }}>\n <ExitIcon fontSize=\"small\" />\n </ButtonEx>\n : null}\n </Alert>\n )\n}\n","import { FlexCol } from '@xylabs/react-flexbox'\nimport { useEffect } from 'react'\n\nimport { ErrorAlert } from './ErrorAlert.js'\nimport { ErrorRenderProps } from './Props.js'\n\nexport const ErrorRender: React.FC<ErrorRenderProps> = ({\n onCancel,\n error,\n noErrorDisplay = false,\n customError = null,\n children,\n errorContext,\n scope,\n useLocation,\n ...props\n}) => {\n const location = useLocation?.()\n useEffect(() => {\n if (location) {\n // ensure we end up at the same place we are now after logging in\n location.state = {\n from: {\n pathname: window.location.pathname,\n },\n }\n }\n }, [location])\n\n return error ?\n <FlexCol alignItems=\"stretch\" {...props}>\n {noErrorDisplay ?\n customError\n : <FlexCol alignItems=\"center\" {...props}>\n <ErrorAlert error={error} errorContext={errorContext} onCancel={onCancel} scope={scope} />\n </FlexCol>\n }\n </FlexCol>\n : (<>{children}</> ?? null)\n}\n","import { WithChildren } from '@xylabs/react-shared'\nimport { useEffect, useState } from 'react'\nimport Rollbar from 'rollbar'\n\nimport { ErrorReporterContext } from './Context.js'\n\nexport interface ErrorReporterProviderProps {\n rollbar: Rollbar\n}\n\nconst ErrorReporterProvider: React.FC<WithChildren<ErrorReporterProviderProps>> = ({ children, rollbar }) => {\n const [rollbarInstance, setRollBarInstance] = useState<Rollbar>()\n\n useEffect(() => {\n if (rollbarInstance) {\n setRollBarInstance(rollbarInstance)\n }\n }, [rollbar, rollbarInstance])\n\n return <ErrorReporterContext.Provider value={{ rollbar }}>{children}</ErrorReporterContext.Provider>\n}\n\nexport { ErrorReporterProvider }\n","import { createContext } from 'react'\n\nimport { ErrorReporterContextState } from './State.js'\n\nexport const ErrorReporterContext = createContext<ErrorReporterContextState>({})\n","import { useContext } from 'react'\n\nimport { ErrorReporterContext } from './Context.js'\n\nconst useRollbar = () => {\n const context = useContext(ErrorReporterContext)\n if (context === undefined) {\n console.warn('useRollbar must be used within a ErrorReporterContext')\n }\n\n return context ?? {}\n}\n\nexport { useRollbar }\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,2BAA+C;AAC/C,IAAAA,gBAAgD;;;ACDhD,4BAAsC;AACtC,sBAA0D;AAC1D,0BAAyB;AAuBnB;AAXC,IAAM,aA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BAAU,MAAM;AACd,QAAI,iBAAiB;AACnB,yBAAmB,eAAe;AAAA,IACpC;AAAA,EACF,GAAG,CAAC,SAAS,eAAe,CAAC;AAE7B,SAAO,6CAAC,qBAAqB,UAArB,EAA8B,OAAO,EAAE,QAAQ,GAAI,UAAS;AACtE;;;AEpBA,IAAAC,gBAA2B;AAI3B,IAAM,aAAa,MAAM;AACvB,QAAM,cAAU,0BAAW,oBAAoB;AAC/C,MAAI,YAAY,QAAW;AACzB,YAAQ,KAAK,uDAAuD;AAAA,EACtE;AAEA,SAAO,WAAW,CAAC;AACrB;","names":["import_react","ExitIcon","import_jsx_runtime","import_jsx_runtime","import_react","import_react","import_jsx_runtime","import_react"]}
|
package/dist/node/index.js
CHANGED
@@ -7,12 +7,25 @@ import { ExitToApp as ExitIcon } from "@mui/icons-material";
|
|
7
7
|
import { Alert, AlertTitle, Typography } from "@mui/material";
|
8
8
|
import { ButtonEx } from "@xylabs/react-button";
|
9
9
|
import { jsx, jsxs } from "react/jsx-runtime";
|
10
|
-
var ErrorAlert = ({
|
10
|
+
var ErrorAlert = ({
|
11
|
+
title = "Whoops! Something went wrong",
|
12
|
+
onCancel,
|
13
|
+
error = "An unknown error occurred",
|
14
|
+
errorContext,
|
15
|
+
scope,
|
16
|
+
...props
|
17
|
+
}) => {
|
18
|
+
const finalScope = scope ?? errorContext;
|
11
19
|
return /* @__PURE__ */ jsxs(Alert, { severity: "error", ...props, children: [
|
12
|
-
/* @__PURE__ */ jsx(AlertTitle, { children:
|
13
|
-
|
14
|
-
|
15
|
-
|
20
|
+
/* @__PURE__ */ jsx(AlertTitle, { children: title }),
|
21
|
+
finalScope ? /* @__PURE__ */ jsxs("div", { children: [
|
22
|
+
/* @__PURE__ */ jsx(Typography, { variant: "caption", mr: 0.5, fontWeight: "bold", children: "Scope:" }),
|
23
|
+
/* @__PURE__ */ jsx(Typography, { variant: "caption", children: finalScope })
|
24
|
+
] }) : null,
|
25
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
26
|
+
/* @__PURE__ */ jsx(Typography, { variant: "caption", mr: 0.5, fontWeight: "bold", children: "Error:" }),
|
27
|
+
/* @__PURE__ */ jsx(Typography, { variant: "caption", children: typeof error === "string" ? error : error == null ? void 0 : error.message })
|
28
|
+
] }),
|
16
29
|
onCancel ? /* @__PURE__ */ jsx(ButtonEx, { variant: "outlined", size: "small", onClick: onCancel, position: "absolute", style: { right: 8, top: 8 }, children: /* @__PURE__ */ jsx(ExitIcon, { fontSize: "small" }) }) : null
|
17
30
|
] });
|
18
31
|
};
|
@@ -28,6 +41,7 @@ var ErrorRender = ({
|
|
28
41
|
customError = null,
|
29
42
|
children,
|
30
43
|
errorContext,
|
44
|
+
scope,
|
31
45
|
useLocation,
|
32
46
|
...props
|
33
47
|
}) => {
|
@@ -41,7 +55,7 @@ var ErrorRender = ({
|
|
41
55
|
};
|
42
56
|
}
|
43
57
|
}, [location]);
|
44
|
-
return error ? /* @__PURE__ */ jsx2(FlexCol, { alignItems: "stretch", ...props, children: noErrorDisplay ? customError : /* @__PURE__ */ jsx2(FlexCol, { alignItems: "center", ...props, children: /* @__PURE__ */ jsx2(ErrorAlert, { error, errorContext, onCancel }) }) }) : /* @__PURE__ */ jsx2(Fragment, { children }) ?? null;
|
58
|
+
return error ? /* @__PURE__ */ jsx2(FlexCol, { alignItems: "stretch", ...props, children: noErrorDisplay ? customError : /* @__PURE__ */ jsx2(FlexCol, { alignItems: "center", ...props, children: /* @__PURE__ */ jsx2(ErrorAlert, { error, errorContext, onCancel, scope }) }) }) : /* @__PURE__ */ jsx2(Fragment, { children }) ?? null;
|
45
59
|
};
|
46
60
|
|
47
61
|
// src/components/ErrorBoundary/ThrownErrorBoundary.tsx
|
@@ -67,12 +81,12 @@ var ThrownErrorBoundary = class _ThrownErrorBoundary extends Component {
|
|
67
81
|
}
|
68
82
|
render() {
|
69
83
|
const { xyoError } = this.state;
|
70
|
-
const { children, boundaryName, errorComponent } = this.props;
|
84
|
+
const { children, boundaryName, errorComponent, scope, title } = this.props;
|
71
85
|
if (xyoError) {
|
72
86
|
if (errorComponent) {
|
73
87
|
return errorComponent(xyoError);
|
74
88
|
}
|
75
|
-
return /* @__PURE__ */ jsx3(ErrorRender, { error: xyoError, errorContext: `${boundaryName} Boundary
|
89
|
+
return /* @__PURE__ */ jsx3(ErrorRender, { error: xyoError, errorContext: `${boundaryName} Boundary`, scope, title });
|
76
90
|
}
|
77
91
|
return children;
|
78
92
|
}
|