eclipse-cdt-cloud / cdt-gdb-adapter

CDT GDB Debug Adapter
Eclipse Public License 2.0
27 stars 40 forks source link

Report errors on opening serial ports to Debug Console #281

Closed jonahgraham closed 1 year ago

jonahgraham commented 1 year ago

The new UART code can fail to open the UART and it leads to weird feedback.

The setup is to have a typo in the port:

          "uart": {
            "serialPort": "/mistake",
          }

This leads to a {} in the debug console, here you see it while running verbose:

image

The underlying issue is lost because it is on node's output which gets interpreted by VSCode as DAP and it falls over a little here as a result.

Running the adapter in server mode:

https://github.com/eclipse-cdt-cloud/cdt-gdb-adapter/blob/92bb15046fea82256742a69f0b240129a1949a76/.vscode/launch.json#L16

and connecting to it with "debugServer": 4711 in the launch.json shows what ended up on the output in the debug console:

image

The key part is:

(node:479803) UnhandledPromiseRejectionWarning: Error: Error: No such file or directory, cannot open /mistake

Therefore this PR adds error handling on serial port to make sure errors are passed back to the user.

jonahgraham commented 1 year ago

@AdhamRagabMCHP - can you have a review of this please.