Improve server error serialization for generateLink and listUsers
cgen-83fb578291cb4958a10bf3f3295acec4
This commit is contained in:
parent
65c82316af
commit
cf13c97239
1 changed files with 4 additions and 3 deletions
|
|
@ -57,12 +57,13 @@ export function createServer() {
|
|||
|
||||
if (error) {
|
||||
console.error("[API] generateLink error:", {
|
||||
message: error.message,
|
||||
status: error.status,
|
||||
message: error?.message || String(error),
|
||||
status: (error as any)?.status || null,
|
||||
code: (error as any)?.code || null,
|
||||
details: (error as any)?.details || null,
|
||||
});
|
||||
return res.status(error.status ?? 500).json({ error: error.message });
|
||||
const errMsg = typeof error === "string" ? error : (error?.message || JSON.stringify(error));
|
||||
return res.status((error as any)?.status ?? 500).json({ error: errMsg });
|
||||
}
|
||||
|
||||
const actionLink =
|
||||
|
|
|
|||
Loading…
Reference in a new issue