Skip to content

Commit

Permalink
fix error message
Browse files Browse the repository at this point in the history
  • Loading branch information
xavimondev committed May 1, 2024
1 parent 175b683 commit e93da57
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 12 deletions.
4 changes: 2 additions & 2 deletions apps/web/app/api/code-generation/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export async function POST(req: Request) {
return NextResponse.json(
{
data: undefined,
error: "Missing API KEY – make sure to set it.",
message: "Missing API KEY – make sure to set it.",
},
{ status: 400 }
);
Expand All @@ -43,7 +43,7 @@ export async function POST(req: Request) {
return NextResponse.json(
{
data: undefined,
error:
message:
"Missing OPENAI_API_KEY – make sure to add it to your .env file.",
},
{ status: 400 }
Expand Down
12 changes: 2 additions & 10 deletions apps/web/app/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,16 +62,8 @@ export default function Page(): JSX.Element {
});
},
onError: (err) => {
let alert = "";
if (typeof err === "string") {
const error = JSON.parse(err);
alert = error.message;
} else {
// @ts-ignore
alert = err.error;
}

toast.error(alert);
const result = JSON.parse(err.message);
toast.error(result.message);

setBlobURL(null);
setFinished(true);
Expand Down

0 comments on commit e93da57

Please sign in to comment.