chore: clean up unused param

This commit is contained in:
Simon
2025-12-08 17:20:03 +08:00
parent d0836fd788
commit 3e6c431a0b

View File

@@ -87,7 +87,7 @@ export class LLM {
displayText: `retry-ing (${retries} / ${this.config.maxRetries})`, displayText: `retry-ing (${retries} / ${this.config.maxRetries})`,
}) })
}, },
onError: (error: Error, withRetry: boolean) => { onError: (error: Error) => {
this.#bus.emit('panel:update', { this.#bus.emit('panel:update', {
type: 'error', type: 'error',
displayText: `step failed: ${(error as Error).message}`, displayText: `step failed: ${(error as Error).message}`,
@@ -103,7 +103,7 @@ async function withRetry<T>(
settings: { settings: {
maxRetries: number maxRetries: number
onRetry: (retries: number) => void onRetry: (retries: number) => void
onError: (error: Error, withRetry: boolean) => void onError: (error: Error) => void
} }
): Promise<T> { ): Promise<T> {
let retries = 0 let retries = 0
@@ -118,7 +118,7 @@ async function withRetry<T>(
return await fn() return await fn()
} catch (error: unknown) { } catch (error: unknown) {
console.error(error) console.error(error)
settings.onError(error as Error, retries < settings.maxRetries) settings.onError(error as Error)
// do not retry if aborted by user // do not retry if aborted by user
if ((error as { name?: string })?.name === 'AbortError') throw error if ((error as { name?: string })?.name === 'AbortError') throw error