fix: drop unreachable WebError rethrow in exa/perplexity search

The `if (error instanceof WebError) throw error` guard is dead code in the
exa and perplexity providers: their mappers (mapExaResponse /
mapPerplexityResponse) never throw a WebError — a wrong-shape body throws a
TypeError, which the catch correctly translates to WEB_PROVIDER_ERROR. The
guard was added for symmetry with the deepseek provider, whose mapper DOES
throw a WebError in strict mode (no web_search_tool_result block), so it
keeps the rethrow. The unreachable lines tripped the per-file 100% coverage
gate.
This commit is contained in:
Dudu-0223
2026-06-29 17:39:52 +08:00
parent 8395722db5
commit bb8f7799ce
2 changed files with 0 additions and 2 deletions

View File

@@ -123,7 +123,6 @@ export class ExaSearchProvider implements WebSearchProvider {
return mapExaResponse(request.query, payload)
} catch (error: unknown) {
if (isAbortError(error)) throw new WebError('Exa search aborted', 'WEB_ABORTED', { cause: error })
if (error instanceof WebError) throw error
throw new WebError(`Exa returned an unprocessable response body: ${String(error)}`, 'WEB_PROVIDER_ERROR', { cause: error })
}
}

View File

@@ -131,7 +131,6 @@ export class PerplexitySearchProvider implements WebSearchProvider {
return mapPerplexityResponse(request.query, payload)
} catch (error: unknown) {
if (isAbortError(error)) throw new WebError('Perplexity search aborted', 'WEB_ABORTED', { cause: error })
if (error instanceof WebError) throw error
throw new WebError(`Perplexity returned an unprocessable response body: ${String(error)}`, 'WEB_PROVIDER_ERROR', { cause: error })
}
}