Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect error details when the LoadSketchRequest fails with NOT_FOUND error #1797

Closed
3 tasks done
kittaakos opened this issue Jul 8, 2022 · 1 comment · Fixed by #1805
Closed
3 tasks done

Incorrect error details when the LoadSketchRequest fails with NOT_FOUND error #1797

kittaakos opened this issue Jul 8, 2022 · 1 comment · Fixed by #1805
Assignees
Labels
conclusion: resolved Issue was resolved criticality: medium Of moderate impact topic: code Related to content of the project itself type: imperfection Perceived defect in any part of project

Comments

@kittaakos
Copy link
Contributor

kittaakos commented Jul 8, 2022

Describe the problem

If I have such a gRPC LoadSketchRequest:

{
    "instance": {
        "id": 1
    },
    "sketchPath": "/Users/a.kitta/Documents/Arduino/alma"
}

And the folder is missing from the file system:

 % cd ~/Documents/Arduino/alma
cd: no such file or directory: /Users/a.kitta/Documents/Arduino/alma

Then the request correctly fails with a NOT_FOUND status code but the error details is incorrect:

{
    "code": 5,
    "details": "Can't open sketch: no valid sketch found in /Users/a.kitta/Documents/Arduino: missing /Users/a.kitta/Documents/Arduino/Arduino.ino",
    "metadata": {
        "content-type": [
            "application/grpc"
        ]
    }
}

The error message should be about Arduino/alma/alma.ino and not Arduino/Arduino.ino. The directories.user location exists on my disk:

% ls -al ~/Documents/Arduino 
total 0
drwxr-xr-x  2 a.kitta  staff   64 Jul  8 16:50 .
drwx------+ 5 a.kitta  staff  160 Jul  6 15:46 ..

To reproduce

Screen Shot 2022-07-08 at 17 05 58

Expected behavior

It should complain about ~/Documents/Arduino/alma and not ~/Documents/Arduino/

Arduino CLI version

0.24.0

Operating system

macOS

Operating system version

12.3.1

Additional context

No response

Issue checklist

  • I searched for previous reports in the issue tracker
  • I verified the problem still occurs when using the nightly build
  • My report contains all necessary details
@kittaakos kittaakos added type: imperfection Perceived defect in any part of project topic: gRPC Related to the gRPC interface labels Jul 8, 2022
@per1234 per1234 added the criticality: medium Of moderate impact label Jul 9, 2022
@per1234
Copy link
Contributor

per1234 commented Jul 9, 2022

The issue also occurs with the Arduino CLI command line interface:

$ arduino-cli version
arduino-cli.exe  Version: git-snapshot Commit: 6ac5f7a3 Date: 2022-07-09T19:16:18Z

$ mkdir /tmp/Arduino

$ arduino-cli compile -b arduino:avr:uno /tmp/Arduino/alma
Error opening sketch: no valid sketch found in C:\Users\per\AppData\Local\Temp\Arduino: missing C:\Users\per\AppData\Local\Temp\Arduino\Arduino.ino

$ arduino-cli compile -b arduino:avr:uno /tmp/Arduino/alma/alma.ino
Error opening sketch: reading files: open C:\Users\per\AppData\Local\Temp\Arduino\alma: The system cannot find the file specified.

$ arduino-cli compile -b arduino:avr:uno /tmp/Arduino/alma/nonexistent
Error opening sketch: reading files: open C:\Users\per\AppData\Local\Temp\Arduino\alma: The system cannot find the file specified.

The error message code was written based on the unwarranted assumption that people always provide the full path to the .ino file. However, it's faster and more correct (because the folder is the sketch, not the .ino file) to only provide the path to the sketch folder.

@per1234 per1234 added topic: code Related to content of the project itself and removed topic: gRPC Related to the gRPC interface labels Jul 9, 2022
@per1234 per1234 changed the title [gRPC] Incorrect error details when the LoadSketchRequest fails with NOT_FOUND error Incorrect error details when the LoadSketchRequest fails with NOT_FOUND error Jul 9, 2022
@per1234 per1234 added the conclusion: resolved Issue was resolved label Jul 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
conclusion: resolved Issue was resolved criticality: medium Of moderate impact topic: code Related to content of the project itself type: imperfection Perceived defect in any part of project
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants