2
.github/workflows/release.yaml
vendored
2
.github/workflows/release.yaml
vendored
@@ -37,7 +37,7 @@ jobs:
|
||||
cache: "npm"
|
||||
|
||||
- name: Update npm
|
||||
- run: "npm i -g npm@11.8.0"
|
||||
run: npm i -g npm@11.8.0
|
||||
|
||||
- name: Install dependencies
|
||||
run: npm ci
|
||||
|
||||
@@ -14,7 +14,7 @@ const classNames = {
|
||||
|
||||
type Props = {
|
||||
resetErrorBoundary?: () => void;
|
||||
error?: string;
|
||||
error?: Error;
|
||||
};
|
||||
|
||||
export function PageError({ resetErrorBoundary, error: propsError }: Props) {
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
import { Role } from "@probo/helpers";
|
||||
import { lazy } from "@probo/react-lazy";
|
||||
import {
|
||||
ForbiddenError,
|
||||
UnAuthenticatedError,
|
||||
UnauthorizedError,
|
||||
} from "@probo/relay";
|
||||
import { type AppRoute, routeFromAppRoute } from "@probo/routes";
|
||||
import { CenteredLayout } from "@probo/ui";
|
||||
@@ -42,22 +40,14 @@ import { vendorRoutes } from "./routes/vendorRoutes";
|
||||
/**
|
||||
* Top level error boundary
|
||||
*/
|
||||
function ErrorBoundary({ error: propsError }: { error?: string }) {
|
||||
const error = useRouteError() ?? propsError;
|
||||
function ErrorBoundary() {
|
||||
const error = useRouteError();
|
||||
|
||||
if (error instanceof UnAuthenticatedError) {
|
||||
return <Navigate to="/auth/login" />;
|
||||
}
|
||||
|
||||
if (error instanceof UnauthorizedError) {
|
||||
return <PageError error="UNAUTHORIZED" />;
|
||||
}
|
||||
|
||||
if (error instanceof ForbiddenError) {
|
||||
return <PageError error="FORBIDDEN" />;
|
||||
}
|
||||
|
||||
return <PageError error={error instanceof Error ? error.message : ""} />;
|
||||
return <PageError error={error instanceof Error ? error : new Error("unkown error")} />;
|
||||
}
|
||||
|
||||
const routes = [
|
||||
|
||||
@@ -13,7 +13,7 @@ const classNames = {
|
||||
|
||||
type Props = {
|
||||
resetErrorBoundary?: () => void;
|
||||
error?: string;
|
||||
error?: Error;
|
||||
};
|
||||
|
||||
export function PageError({ resetErrorBoundary, error: propsError }: Props) {
|
||||
|
||||
@@ -26,10 +26,10 @@ import { consoleEnvironment } from "./providers/RelayProviders.tsx";
|
||||
/**
|
||||
* Top level error boundary
|
||||
*/
|
||||
function ErrorBoundary({ error: propsError }: { error?: string }) {
|
||||
const error = useRouteError() ?? propsError;
|
||||
function ErrorBoundary() {
|
||||
const error = useRouteError();
|
||||
|
||||
return <PageError error={error instanceof Error ? error.message : ""} />;
|
||||
return <PageError error={error instanceof Error ? error : new Error("unkown error")} />;
|
||||
}
|
||||
|
||||
const routes = [
|
||||
|
||||
Reference in New Issue
Block a user