Skip to content

Commit d2572b5

Browse files
committed
Cloud: log session refresh errors
1 parent 900de7b commit d2572b5

File tree

1 file changed

+12
-7
lines changed

1 file changed

+12
-7
lines changed

packages/cloud/src/AuthService.ts

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -281,14 +281,19 @@ export class AuthService extends EventEmitter<AuthServiceEvents> {
281281
return
282282
}
283283

284-
const previousState = this.state
285-
this.sessionToken = await this.clerkCreateSessionToken()
286-
this.state = "active-session"
284+
try {
285+
const previousState = this.state
286+
this.sessionToken = await this.clerkCreateSessionToken()
287+
this.state = "active-session"
287288

288-
if (previousState !== "active-session") {
289-
console.log("[auth] Transitioned to active-session state")
290-
this.emit("active-session", { previousState })
291-
this.fetchUserInfo()
289+
if (previousState !== "active-session") {
290+
console.log("[auth] Transitioned to active-session state")
291+
this.emit("active-session", { previousState })
292+
this.fetchUserInfo()
293+
}
294+
} catch (error) {
295+
console.error("[auth] Failed to refresh session", error)
296+
throw error
292297
}
293298
}
294299

0 commit comments

Comments
 (0)