typescript-go icon indicating copy to clipboard operation
typescript-go copied to clipboard

Return errors instead of panics

Open makhov opened this issue 9 months ago • 2 comments

tsgo heavily overuses panics, that can lead to the situations mentioned in #631:

The typescript-go-lsp server crashed 5 times in the last 3 minutes. The server will not be restarted. See the output for more information.

PR is intended to start moving the codebase towards more idiomatic error handling. Atm, I've changed 2 panics and we probably need to agree on the approach: I can keep adding changes to this PR, but it'll be big and hard to follow, or I can create a separate PRs to keep them small and simple.

makhov avatar Mar 16 '25 18:03 makhov

@microsoft-github-policy-service agree

makhov avatar Mar 16 '25 19:03 makhov

I think this PR should be closed. In general, TS panics when something is badly broken, and things are commonly broken in Corsa's preview state. In the language server case, I predict we'll continue to use panics, and then handle panics in a central place.

sandersn avatar Apr 30 '25 17:04 sandersn