Skip to content

Commit

Permalink
public: More error logging on server during API fetch
Browse files Browse the repository at this point in the history
  • Loading branch information
somnisomni committed Dec 20, 2024
1 parent 7f5cea5 commit fdb83c4
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion projects/Public/plugins/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,12 @@ export default defineNuxtPlugin((nuxt) => {
$internalStore.isAPIFetchFailed = false;
return data.value;
} catch(error) {
console.error(`API Fetch Failed! (running on ${import.meta.env.SSR ? "server" : "client"}):`, error);
console.error(`[API] Fetch failed! (running on ${import.meta.env.SSR ? "server" : "client"}):`);
if(import.meta.env.SSR) {
console.error(" - API fetch wrapper callee function: ", callee.toString());
console.error(" - Error: ", error);
}

$internalStore.isAPIFetchFailed = true;
return { errorCode: ErrorCodes.UNKNOWN_ERROR } as IErrorResponse;
}
Expand Down

0 comments on commit fdb83c4

Please sign in to comment.