MCPcopy Create free account
hub / github.com/Zoo-Code-Org/Zoo-Code / callApiWithRetry

Method callApiWithRetry

src/api/providers/qwen-code.ts:197–212  ·  view source on GitHub ↗
(apiCall: () => Promise<T>)

Source from the content-addressed store, hash-verified

195 }
196
197 private async callApiWithRetry<T>(apiCall: () => Promise<T>): Promise<T> {
198 try {
199 return await apiCall()
200 } catch (error: any) {
201 if (error.status === 401) {
202 // Token expired, refresh and retry
203 this.credentials = await this.refreshAccessToken(this.credentials!)
204 const client = this.ensureClient()
205 client.apiKey = this.credentials.access_token
206 client.baseURL = this.getBaseUrl(this.credentials)
207 return await apiCall()
208 } else {
209 throw error
210 }
211 }
212 }
213
214 override async *createMessage(
215 systemPrompt: string,

Callers 2

createMessageMethod · 0.95
completePromptMethod · 0.95

Calls 3

refreshAccessTokenMethod · 0.95
ensureClientMethod · 0.95
getBaseUrlMethod · 0.95

Tested by

no test coverage detected