File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -3244,13 +3244,21 @@ export const auth = betterAuth({
32443244 } ) ,
32453245 signal : AbortSignal . timeout ( QUICKBOOKS_OAUTH_REQUEST_TIMEOUT_MS ) ,
32463246 } )
3247+ if ( ! response . ok ) {
3248+ await readResponseTextWithLimit ( response , {
3249+ maxBytes : DEFAULT_MAX_ERROR_BODY_BYTES ,
3250+ label : 'QuickBooks OAuth token error response' ,
3251+ } ) . catch ( ( ) => { } )
3252+ throw new Error ( `QuickBooks OAuth token exchange failed with HTTP ${ response . status } ` )
3253+ }
3254+
32473255 const data = await readResponseJsonWithLimit < Record < string , unknown > > ( response , {
32483256 maxBytes : DEFAULT_MAX_ERROR_BODY_BYTES ,
32493257 label : 'QuickBooks OAuth token response' ,
32503258 } )
32513259
3252- if ( ! response . ok || ! data || typeof data !== 'object' || Array . isArray ( data ) ) {
3253- throw new Error ( ` QuickBooks OAuth token exchange failed with HTTP ${ response . status } ` )
3260+ if ( ! data || typeof data !== 'object' || Array . isArray ( data ) ) {
3261+ throw new Error ( ' QuickBooks OAuth token exchange returned an invalid response' )
32543262 }
32553263
32563264 const tokens = getOAuth2Tokens ( data )
You can’t perform that action at this time.
0 commit comments