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:
@@ -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 })
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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 })
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user