Skip to content

Commit

Permalink
fix: show sensitive error to the user
Browse files Browse the repository at this point in the history
  • Loading branch information
alarv committed Oct 17, 2024
1 parent 0318e8d commit 29282d2
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion src/app/dashboard/models/[modelId]/[tabName]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import { Link } from '@nextui-org/link';
import React from 'react';
import { Tooltip } from '@nextui-org/tooltip';
import { logger } from '@/logger';
import CustomErrorPage from '@/app/components/CustomErrorPage';

const log = logger.child({ module: 'modelPage' });

Expand Down Expand Up @@ -134,7 +135,17 @@ async function retrieveModelOrLegacy(modelId: string): Promise<ModelDto> {
}

export default async function Page({ params }: { params: ModelPageParams }) {
const model = await retrieveModelOrLegacy(params.modelId);
let model;
try {
model = await retrieveModelOrLegacy(params.modelId);
} catch (e) {
return (
<CustomErrorPage
title="Something's wrong here 🚧"
description={(e as any)?.message}
/>
);
}

return (
<div className="p-2 sm:p-0">
Expand Down

0 comments on commit 29282d2

Please sign in to comment.