ruby / debug

Debugging functionality for Ruby
BSD 2-Clause "Simplified" License
1.14k stars 127 forks source link

Debugger exceptions crash the debugger and disconnect from the client #1006

Open amomchilov opened 1 year ago

amomchilov commented 1 year ago

Your environment

Describe the bug Developing the CDP/DAP servers can be quite tedious, because any mistakes can raise exceptions that aren't caught, crash the server, and disconnect your IDE. Each time it requires restarting your debugger session.

To Reproduce

Add a raise anywhere in the protocol servers, e.g. where variables are rendered.

Expected behavior A error response to be sent to the client, which can display a message with error details.

Instead, the exception is raised, the debug adapter crashes, and the client disconnects.

Additional context

I played around with implementing this here, and got it working for the :scope and :variables requests.

It's pretty fiddly, it looks like each when branch needs to be wrapped in a separate begin/rescue block, which is quite tedious. I wonder if there's a more central place to rescue it.

It would also need to be implemented twice, because of all this logic is duplicated between the DAP and CDP servers.

niltonvasques commented 1 year ago

We noticed that this is also happening quite often with the devs in the company. :up: