sourcegraph / cody

AI that knows your entire codebase
https://cody.dev
Apache License 2.0
2.24k stars 213 forks source link

vscode: use NetworkError in nodeClient #4646

Closed keegancsmith closed 1 week ago

keegancsmith commented 1 week ago

I was running into a cloudflare issue on s2 when communicating with the LLM. It was quite hard to diagnose since the error message and our logging only contained the response body. This updates SourcegraphNodeCompletionsClient to use NetworkError in the same way our code completions client uses it.

Side-note: it seems like there is a lot of duplication. It seems like there is an opportunity to share code. In particular the code completion client seems well written and more effectively uses instrumentation and error wrapping.

Test Plan: while I could reproduce cloudflare issues I manually tested that the error response shown improved.

Before

image

After

image