Skip to content

Commit

Permalink
Fail safer in getAppMeta
Browse files Browse the repository at this point in the history
  • Loading branch information
zner0L committed Oct 17, 2024
1 parent c42ffb0 commit 1bff948
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/pages/p/[platform]/[appId]/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,13 @@ export const POST: APIRoute = async ({ params, redirect, currentLocale, clientAd

const token = nanoid();

const appMeta = await getAppMeta({ platform, appId, language: currentLocale || 'en' });
let appMeta;
try {
appMeta = await getAppMeta({ platform, appId, language: currentLocale || 'en' });
} catch (e) {
// TODO: Proper error handling
return new Response('Getting the apps’s metadata failed.', { status: 500 });
}
if (!appMeta) return new Response('App not found.', { status: 404 });

const { token: analysisToken } = await startAnalysis(platform, appMeta.appId);
Expand Down

0 comments on commit 1bff948

Please sign in to comment.