Support exceptionOptions in setExceptionBreakpoints to catch arbitrary exception classes via DAP

Open
#1,182 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
55/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Quiet
Tech stack
ruby
Domain
devtools

Research direction

Start with lib/debug/server_dap.rb around the supportsExceptionOptions capability and compare the setExceptionBreakpoints handling with the DAP specification. Trace how exception filters are represented, then verify that arbitrary exception classes can be requested through DAP without changing the existing any and RuntimeError behavior.

Written by the indexing model from the issue text.

Description

Your proposal

I'd like to catch exceptions of an arbitrary class via DAP (Debug Adapter Protocol), just like the console UI's catch MyError command.
Currently it is not possible to catch exceptions by specifying an arbitrary class via DAP.
I believe this can be achieved by handling the exceptionOptions argument of the setExceptionBreakpoints request and enabling the corresponding capability.

Reference: setExceptionBreakpoints in the DAP specification
https://microsoft.github.io/debug-adapter-protocol//specification.html

supportsExceptionOptions is listed as "Will be supported" in https://github.com/ruby/debug/blob/6510cfbc7496c55ebbefa437a25c17ca58f7c5eb/lib/debug/server_dap.rb#L169

Additional context

Background:
While developing an MCP server for the debug gem, I ran into the problem that catching an exception of a specific class is not possible via DAP.
rira100000000/debug-mcp

The standard filters are only two: any (all exceptions) and RuntimeError, so currently the only choices are catching every error or catching only RuntimeError.
With any, every Exception is caught — including ones raised internally by frameworks such as Rails — which produces a lot of noise before you reach the exception you actually care about.

Dominant language
Ruby
Stars
1.3k
Forks
146
PR merge metrics
No merged PRs in 30d

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from ruby/debug

All issues in ruby/debug

Similar issues

More Ruby issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.