arduino-cli icon indicating copy to clipboard operation
arduino-cli copied to clipboard

[gRPC]: Error object contains insufficient info when upload fails due to the busy serial port

Open kittaakos opened this issue 3 years ago • 0 comments
trafficstars

Describe the problem

If the upload failed due to the busy serial port, I would love to see that on the error object. Currently, the ServiceError object contains the following info:

{
    "code": 13,
    "details": "Failed uploading: uploading error: exit status 1",
    "metadata": {}
}

During the upload, the UploadResponse's out_stream contains ...... and the err_stream is empty.

However, I can see the following messages logged by the CLI daemon process:

{"level":"info","msg":"Performing 1200-bps touch reset on serial port /dev/cu.usbmodem14301","phase":"board reset","time":"2022-06-15T15:19:37+02:00"}
TOUCH: error during reset: opening port at 1200bps: Serial port busy

The CLI knows what went wrong, but with the current errors, it's impossible to show the real cause to the users.

To reproduce

  • Build the IDE2 from the sources,
  • Open the Java IDE, connect a board, upload, and start the serial monitor so that the serial port will be busy,
  • Start the IDE2 and debug the IDE2 backend code,
  • Start an upload from IDE2,
  • See the error object
{
    "code": 13,
    "details": "Failed uploading: uploading error: exit status 1",
    "metadata": {}
}

Expected behavior

The error object contains what is logged by the daemon process.

Arduino CLI version

arduino-cli Version: 0.23.0 Commit: 899dc91b Date: 2022-06-06T14:23:44Z

Operating system

macOS

Operating system version

12.3.1

Additional context

Maybe related: https://github.com/arduino/arduino-cli/issues/1762

Issue checklist

  • [X] I searched for previous reports in the issue tracker
  • [X] I verified the problem still occurs when using the nightly build
  • [X] My report contains all necessary details

kittaakos avatar Jun 15 '22 13:06 kittaakos