[all-commits] [llvm/llvm-project] 14cb65: [lldb-dap] Improve error reporting for dap command...

John Harrison via All-commits all-commits at lists.llvm.org
Tue Apr 15 13:30:54 PDT 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 14cb6566d6701feaef2ffd686af5de4ff9e3eb29
      https://github.com/llvm/llvm-project/commit/14cb6566d6701feaef2ffd686af5de4ff9e3eb29
  Author: John Harrison <harjohn at google.com>
  Date:   2025-04-15 (Tue, 15 Apr 2025)

  Changed paths:
    M lldb/tools/lldb-dap/Handler/RequestHandler.h
    M lldb/tools/lldb-dap/Protocol/ProtocolBase.cpp
    M lldb/tools/lldb-dap/Protocol/ProtocolRequests.cpp
    M lldb/tools/lldb-dap/Protocol/ProtocolRequests.h
    M lldb/tools/lldb-dap/Protocol/ProtocolTypes.cpp

  Log Message:
  -----------
  [lldb-dap] Improve error reporting for dap command arguments. (#135684)

Previously the error only contained the failed to parse JSON message,
which has no additional context.

This improves the error messages and improves the consistency of
handling properties in protocol structures. Updating the fields to use
'ObjectMapper.map' instead of 'ObjectMapper.mapOptional' caught that
adapterID was misspelled as well.

For example, previously:

```
$ echo 'Content-Length: 81\r\n\r\n{"type":"request","command":"initialize","seq":1,"arguments":{"adapterID":12345}} | lldb-dap
```

Worked without an error but now it reports:

```
invalid arguments for request 'initialize': expected string at arguments.adapterID
{
  "adapterID": /* error: expected string */ 12345
}
```



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list