@common-stack/frontend-stack-react 6.0.6-alpha.5 → 6.0.6-alpha.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,12 +1,21 @@
|
|
|
1
|
-
import*as React from'react';import {
|
|
1
|
+
import*as React from'react';import {useRouteError,isRouteErrorResponse}from'@remix-run/react';function ErrorBoundary() {
|
|
2
2
|
const error = useRouteError();
|
|
3
3
|
if (isRouteErrorResponse(error)) {
|
|
4
|
-
return React.createElement(
|
|
4
|
+
return (React.createElement("div", null,
|
|
5
|
+
React.createElement("h1", null,
|
|
6
|
+
error.status,
|
|
7
|
+
" ",
|
|
8
|
+
error.statusText),
|
|
9
|
+
React.createElement("p", null, error.data)));
|
|
5
10
|
}
|
|
6
11
|
else if (error instanceof Error) {
|
|
7
|
-
return React.createElement(
|
|
12
|
+
return (React.createElement("div", null,
|
|
13
|
+
React.createElement("h1", null, "Error"),
|
|
14
|
+
React.createElement("p", null, error.message),
|
|
15
|
+
React.createElement("p", null, "The stack trace is:"),
|
|
16
|
+
React.createElement("pre", null, error.stack)));
|
|
8
17
|
}
|
|
9
18
|
else {
|
|
10
|
-
return React.createElement(
|
|
19
|
+
return React.createElement("h1", null, "Unknown Error");
|
|
11
20
|
}
|
|
12
21
|
}export{ErrorBoundary};
|
|
@@ -1,15 +1,24 @@
|
|
|
1
|
-
import*as React from'react';import {useRouteError,isRouteErrorResponse}from'@remix-run/react';
|
|
1
|
+
import*as React from'react';import {useRouteError,isRouteErrorResponse}from'@remix-run/react';function ErrorBoundary() {
|
|
2
2
|
const error = useRouteError();
|
|
3
3
|
React.useEffect(() => {
|
|
4
4
|
console.trace(error);
|
|
5
5
|
}, [error]);
|
|
6
6
|
if (isRouteErrorResponse(error)) {
|
|
7
|
-
return React.createElement(
|
|
7
|
+
return (React.createElement("div", null,
|
|
8
|
+
React.createElement("h1", null,
|
|
9
|
+
error.status,
|
|
10
|
+
" ",
|
|
11
|
+
error.statusText),
|
|
12
|
+
React.createElement("p", null, error.data)));
|
|
8
13
|
}
|
|
9
14
|
else if (error instanceof Error) {
|
|
10
|
-
return React.createElement(
|
|
15
|
+
return (React.createElement("div", null,
|
|
16
|
+
React.createElement("h1", null, "Error"),
|
|
17
|
+
React.createElement("p", null, error.message),
|
|
18
|
+
React.createElement("p", null, "The stack trace is:"),
|
|
19
|
+
React.createElement("pre", null, error.stack)));
|
|
11
20
|
}
|
|
12
21
|
else {
|
|
13
|
-
return React.createElement(
|
|
22
|
+
return React.createElement("h1", null, "Unknown Error");
|
|
14
23
|
}
|
|
15
24
|
}export{ErrorBoundary};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@common-stack/frontend-stack-react",
|
|
3
|
-
"version": "6.0.6-alpha.
|
|
3
|
+
"version": "6.0.6-alpha.6",
|
|
4
4
|
"description": "Client Module for react app",
|
|
5
5
|
"homepage": "https://github.com/cdmbase/fullstack-pro#readme",
|
|
6
6
|
"bugs": {
|
|
@@ -97,5 +97,5 @@
|
|
|
97
97
|
"typescript": {
|
|
98
98
|
"definition": "lib/index.d.ts"
|
|
99
99
|
},
|
|
100
|
-
"gitHead": "
|
|
100
|
+
"gitHead": "d2156c5ec927c17faca0781867c440fe73ba1b59"
|
|
101
101
|
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import*as React from'react';import {Box,VStack,Heading,Text,Code,Button}from'@chakra-ui/react';const Error500 = ({ title, status, data }) => {
|
|
2
|
-
const handleReload = () => {
|
|
3
|
-
window.location.reload();
|
|
4
|
-
};
|
|
5
|
-
return (React.createElement(Box, { display: "flex", alignItems: "center", justifyContent: "center", height: "100vh" },
|
|
6
|
-
React.createElement(VStack, { spacing: 4, textAlign: "center" },
|
|
7
|
-
React.createElement(Heading, { as: "h1", size: "xl" },
|
|
8
|
-
"Error ",
|
|
9
|
-
status),
|
|
10
|
-
React.createElement(Text, null, title),
|
|
11
|
-
data && (React.createElement(Box, { maxW: "md", mx: "auto", overflow: "auto" },
|
|
12
|
-
React.createElement(Code, { p: 4, display: "block", whiteSpace: "pre", textAlign: "left" }, typeof data === 'string' ? data : JSON.stringify(data, null, 2)))),
|
|
13
|
-
React.createElement(Button, { colorScheme: "teal", onClick: handleReload }, "Reload"))));
|
|
14
|
-
};export{Error500 as default};
|