refactor(#65): Enhance error logging with request context

This commit is contained in:
Josh Creek
2024-11-04 19:10:18 +00:00
parent fe1f49090c
commit 8a251f775a
+8 -1
View File
@@ -14,7 +14,14 @@ export const GET = async ({ url }) => {
return json({ products, count }); return json({ products, count });
} catch (error) { } catch (error) {
logger.error(error); logger.error('Failed to fetch products', {
error: error.message,
stack: error.stack,
params: {
limit: limitParam,
offset: offsetParam
}
});
return json({ error: error.message }, { status: 500 }); return json({ error: error.message }, { status: 500 });
} }
}; };