@@ -127,6 +127,12 @@ export const makeInfiniteApi = (config: InfiniteApiConfig): InfiniteApi => {
127127 . join ( '' )
128128 : ''
129129
130+ // Always log API calls for debugging
131+ console . log (
132+ `Infinite API: ${ init ?. method ?? 'GET' } ${ urlStr } ` ,
133+ init ?. body != null ? JSON . parse ( init . body as string ) : ''
134+ )
135+
130136 if ( ENV . DEBUG_VERBOSE_LOGGING ) {
131137 console . log (
132138 `curl -X ${ init ?. method ?? 'GET' } ${ headersStr } '${ urlStr } '${
@@ -135,7 +141,11 @@ export const makeInfiniteApi = (config: InfiniteApiConfig): InfiniteApi => {
135141 )
136142 }
137143
144+ console . log (
145+ `Infinite API: Awaiting fetch for ${ init ?. method ?? 'GET' } ${ urlStr } ...`
146+ )
138147 const response = await fetch ( url , init )
148+ console . log ( `Infinite API: Fetch returned with status ${ response . status } ` )
139149
140150 if ( ! response . ok ) {
141151 const data = await response . text ( )
@@ -258,7 +268,13 @@ export const makeInfiniteApi = (config: InfiniteApiConfig): InfiniteApi => {
258268 } )
259269
260270 const data = await response . text ( )
261- return asInfiniteQuoteResponse ( data )
271+ console . log ( 'Infinite API: Quote raw response:' , data )
272+ try {
273+ return asInfiniteQuoteResponse ( data )
274+ } catch ( err : unknown ) {
275+ console . error ( 'Infinite API: Failed to parse quote response:' , err )
276+ throw err
277+ }
262278 }
263279
264280 // Dummy response - handle both source amount and target amount
@@ -645,7 +661,18 @@ export const makeInfiniteApi = (config: InfiniteApiConfig): InfiniteApi => {
645661 headers : makeHeaders ( )
646662 } )
647663 const data = await response . text ( )
648- return asInfiniteCountriesResponse ( data )
664+ console . log ( 'Infinite API: Countries raw response length:' , data . length )
665+ try {
666+ return asInfiniteCountriesResponse ( data )
667+ } catch ( err : unknown ) {
668+ console . error (
669+ 'Infinite API: Failed to parse countries response:' ,
670+ err ,
671+ 'Raw data:' ,
672+ data . substring ( 0 , 500 )
673+ )
674+ throw err
675+ }
649676 }
650677
651678 // Dummy response
@@ -673,7 +700,21 @@ export const makeInfiniteApi = (config: InfiniteApiConfig): InfiniteApi => {
673700 headers : makeHeaders ( { includeAuth : true } )
674701 } )
675702 const data = await response . text ( )
676- return asInfiniteCurrenciesResponse ( data )
703+ console . log (
704+ 'Infinite API: Currencies raw response length:' ,
705+ data . length
706+ )
707+ try {
708+ return asInfiniteCurrenciesResponse ( data )
709+ } catch ( err : unknown ) {
710+ console . error (
711+ 'Infinite API: Failed to parse currencies response:' ,
712+ err ,
713+ 'Raw data:' ,
714+ data . substring ( 0 , 500 )
715+ )
716+ throw err
717+ }
677718 }
678719
679720 // Dummy response
0 commit comments