File tree Expand file tree Collapse file tree 1 file changed +6
-2
lines changed
packages/toolshed/routes/integrations/google-oauth Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change 11import { OAuth2Client , Tokens } from "@cmd-johnson/oauth2-client" ;
2+ import { getLogger } from "@commontools/utils/logger" ;
23import env from "@/env.ts" ;
34import { runtime } from "@/index.ts" ;
45import { Context } from "@hono/hono" ;
56import { AuthSchema , Mutable , Schema } from "@commontools/runner" ;
6- // Types
7+
8+ const logger = getLogger ( "google-oauth.utils" ) ;
79
810export interface OAuth2Tokens {
911 accessToken : string ;
@@ -186,12 +188,14 @@ export async function persistTokens(
186188 } ;
187189
188190 // Set the new tokens to the auth cell
189- await authCell . runtime . editWithRetry ( ( tx ) => {
191+ const error = await authCell . runtime . editWithRetry ( ( tx ) => {
190192 authCell . withTx ( tx ) . set ( tokenData ) ;
191193 } ) ;
194+ if ( error ) throw error ;
192195
193196 return tokenData ;
194197 } catch ( error ) {
198+ logger . error ( "Error persisting tokens" , error ) ;
195199 throw new Error ( `Error persisting tokens: ${ error } ` ) ;
196200 }
197201}
You can’t perform that action at this time.
0 commit comments