Fix bot review

Signed-off-by: Émile Ré <emile@getprobo.com>
This commit is contained in:
Émile Ré
2026-01-22 21:06:19 +04:00
parent 7dd5e1666d
commit 4d80dccbbf
5 changed files with 9 additions and 19 deletions

View File

@@ -37,7 +37,7 @@ jobs:
cache: "npm" cache: "npm"
- name: Update npm - name: Update npm
- run: "npm i -g npm@11.8.0" run: npm i -g npm@11.8.0
- name: Install dependencies - name: Install dependencies
run: npm ci run: npm ci

View File

@@ -14,7 +14,7 @@ const classNames = {
type Props = { type Props = {
resetErrorBoundary?: () => void; resetErrorBoundary?: () => void;
error?: string; error?: Error;
}; };
export function PageError({ resetErrorBoundary, error: propsError }: Props) { export function PageError({ resetErrorBoundary, error: propsError }: Props) {

View File

@@ -1,9 +1,7 @@
import { Role } from "@probo/helpers"; import { Role } from "@probo/helpers";
import { lazy } from "@probo/react-lazy"; import { lazy } from "@probo/react-lazy";
import { import {
ForbiddenError,
UnAuthenticatedError, UnAuthenticatedError,
UnauthorizedError,
} from "@probo/relay"; } from "@probo/relay";
import { type AppRoute, routeFromAppRoute } from "@probo/routes"; import { type AppRoute, routeFromAppRoute } from "@probo/routes";
import { CenteredLayout } from "@probo/ui"; import { CenteredLayout } from "@probo/ui";
@@ -42,22 +40,14 @@ import { vendorRoutes } from "./routes/vendorRoutes";
/** /**
* Top level error boundary * Top level error boundary
*/ */
function ErrorBoundary({ error: propsError }: { error?: string }) { function ErrorBoundary() {
const error = useRouteError() ?? propsError; const error = useRouteError();
if (error instanceof UnAuthenticatedError) { if (error instanceof UnAuthenticatedError) {
return <Navigate to="/auth/login" />; return <Navigate to="/auth/login" />;
} }
if (error instanceof UnauthorizedError) { return <PageError error={error instanceof Error ? error : new Error("unkown error")} />;
return <PageError error="UNAUTHORIZED" />;
}
if (error instanceof ForbiddenError) {
return <PageError error="FORBIDDEN" />;
}
return <PageError error={error instanceof Error ? error.message : ""} />;
} }
const routes = [ const routes = [

View File

@@ -13,7 +13,7 @@ const classNames = {
type Props = { type Props = {
resetErrorBoundary?: () => void; resetErrorBoundary?: () => void;
error?: string; error?: Error;
}; };
export function PageError({ resetErrorBoundary, error: propsError }: Props) { export function PageError({ resetErrorBoundary, error: propsError }: Props) {

View File

@@ -26,10 +26,10 @@ import { consoleEnvironment } from "./providers/RelayProviders.tsx";
/** /**
* Top level error boundary * Top level error boundary
*/ */
function ErrorBoundary({ error: propsError }: { error?: string }) { function ErrorBoundary() {
const error = useRouteError() ?? propsError; const error = useRouteError();
return <PageError error={error instanceof Error ? error.message : ""} />; return <PageError error={error instanceof Error ? error : new Error("unkown error")} />;
} }
const routes = [ const routes = [