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.
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
After