Skip to content

Commit 3bb6a64

Browse files
mamoon-17Copilot
andauthored
refresh token error handle
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
1 parent 09e3a44 commit 3bb6a64

1 file changed

Lines changed: 12 additions & 1 deletion

File tree

backend/src/modules/auth/auth.controller.ts

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,11 +75,22 @@ export class AuthController {
7575
}
7676

7777
// Save refresh token to database
78-
await authService.updateRefreshToken(
78+
const updateResult = await authService.updateRefreshToken(
7979
user.id,
8080
tokensResult.refreshToken!,
8181
);
8282

83+
if (updateResult.isErr()) {
84+
// Optionally log the persistence error for debugging/monitoring
85+
console.error("Failed to persist refresh token for user", user.id, updateResult.error);
86+
87+
res.status(500).json({
88+
success: false,
89+
error: updateResult.error,
90+
});
91+
return;
92+
}
93+
8394
res.status(201).json({
8495
success: true,
8596
message: "User registered successfully",

0 commit comments

Comments
 (0)