@@ -104,6 +104,7 @@ export function createFapiClient(options: FapiClientOptions): FapiClient {
104104 return true ;
105105 }
106106
107+ // TODO @userland -errors:
107108 function buildQueryString ( { method, path, sessionId, search, rotatingTokenNonce } : FapiRequestInit ) : string {
108109 const searchParams = new URLSearchParams ( search as any ) ;
109110 // the above will parse {key: ['val1','val2']} as key: 'val1,val2' and we need to recreate the array bellow
@@ -148,6 +149,7 @@ export function createFapiClient(options: FapiClientOptions): FapiClient {
148149 const { path, pathPrefix = 'v1' } = requestInit ;
149150
150151 if ( options . proxyUrl ) {
152+ // TODO @userland -errors:
151153 const proxyBase = new URL ( options . proxyUrl ) ;
152154 let proxyPath = proxyBase . pathname . slice ( 1 ) ;
153155 if ( proxyPath . endsWith ( '/' ) ) {
@@ -185,6 +187,7 @@ export function createFapiClient(options: FapiClientOptions): FapiClient {
185187 } ) ;
186188 }
187189
190+ // TODO @userland -errors:
188191 async function request < T > (
189192 _requestInit : FapiRequestInit ,
190193 requestOptions ?: FapiRequestOptions ,
@@ -221,6 +224,7 @@ export function createFapiClient(options: FapiClientOptions): FapiClient {
221224 : body ;
222225 }
223226
227+ // TODO @userland -errors:
224228 const beforeRequestCallbacksResult = await runBeforeRequestCallbacks ( requestInit ) ;
225229 // Due to a known Safari bug regarding CORS requests, we are forced to always use GET or POST method.
226230 // The original HTTP method is used as a query string parameter instead of as an actual method to
@@ -237,6 +241,7 @@ export function createFapiClient(options: FapiClientOptions): FapiClient {
237241 try {
238242 if ( beforeRequestCallbacksResult ) {
239243 const maxTries = requestOptions ?. fetchMaxTries ?? ( isBrowserOnline ( ) ? 4 : 11 ) ;
244+ // TODO @userland -errors:
240245 response = await retry ( ( ) => fetch ( url , fetchOpts ) , {
241246 // This retry handles only network errors, not 4xx or 5xx responses,
242247 // so we want to try once immediately to handle simple network blips.
@@ -271,6 +276,7 @@ export function createFapiClient(options: FapiClientOptions): FapiClient {
271276 if ( ! response . ok ) {
272277 debugLogger . error ( 'request failed' , { method, path : requestInit . path , status : response . status } , 'fapiClient' ) ;
273278 }
279+ // TODO @userland -errors:
274280 await runAfterResponseCallbacks ( requestInit , fapiResponse ) ;
275281 return fapiResponse ;
276282 }
0 commit comments