Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Improve error message due to missing FQBN in upload/compile commands#540

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
federicobond wants to merge1 commit intoarduino:master
base:master
Choose a base branch
Loading
fromfedericobond:handle-sketch-json

Conversation

@federicobond
Copy link
Contributor

@federicobondfedericobond commentedJan 5, 2020
edited by rsora
Loading

No description provided.

@federicobondfedericobondforce-pushed thehandle-sketch-json branch 3 times, most recently from0bce37c tob1a8581CompareJanuary 8, 2020 17:12
@federicobondfedericobond changed the titleHandle FQBNs provided via sketch.json files in upload/compile commandsImprove error message due to missing FQBN in upload/compile commandsJan 8, 2020
@federicobond
Copy link
ContributorAuthor

@masci this is the PR I mentioned in#545

masci reacted with thumbs up emoji

@mascimasci added this to the0.8.0 milestoneJan 9, 2020
@mascimasci modified the milestones:0.8.0,0.9.0Feb 14, 2020
@rsorarsora modified the milestones:0.9.0,0.10.0Feb 21, 2020
@rsora
Copy link
Contributor

Hi@federicobond, I gave a look at your PR, good job!

I was wondering if you want to modify your PR to try another approach for giving better error info to our users:

We moved recently the fqbn / port / sketch folder checksa level below in thecommands module, to better support both the CLI and the gRPC interface.

To maintain a "Single Responsibility Principle" we think it could be better to:

  1. create an error type alias in thecommands package that represents theMissingFqbnError (see this for example
  2. replace your error check in thecli/compile/compile.go andcli/upload/upload.go with an error check that leverages type checking to inspect the error returned from thecompile.Compile() andupload.Upload() functions, for example using aswitch err.(type) { construct

WDYT?

Thanks for your contribution and happy coding!

federicobond reacted with thumbs up emoji

@federicobond
Copy link
ContributorAuthor

Hi, thank you for the feedback,@rsora! One problem I see with that approach is that the error type would not be serialized through the gRPC interface, right? The error message string would, but its type would be lost in the translation.

@federicobond
Copy link
ContributorAuthor

federicobond commentedMar 27, 2020
edited
Loading

I do get your point about the Single Responsibility Principle though, and I am similarly bothered by the duplication we see here, but it's not at all uncommon to have this sort of duplication in other client/server architectures.

Sometimes clients are able to provide richer feedback and developers can take advantage of that, which usually requires some duplication of logic. Sometimes they are not, but it's important that users still receive some feedback from the backend.

Edit: we could do something likethis instead.

rsora reacted with eyes emoji

@rsora
Copy link
Contributor

Hi@federicobond,
I gave a look to the document you posted (thanks for suggesting!) and tried to bind errors generated in thecommands packages withcodes from the package mentioned in the blog post you shared, to imagine how a possible implementation could be.

I ended up having a lot ofInternal Code = 13 errors, becausecommands modules are fairly high level modules, that wraps different errors coming from low level modules that cannot be identified atcommands level.

Additionally, we cannot use thestatus package outside thecommands because we want to avoid leaks of gRPC specific structures in the arduino-cli internals as much as possible.

So, if we need to continue on this path, I guess we should define specific error type alias for bothcommands and lower level modules and use them to:

  • createstatus errors in case of gRPC to send back to client with all the details
  • identify the specific error type at command line interface level and generate a proper CLI message for the user.

What do you think about implementing a POC for this approach? This way we can continue the discussion having some code to look at.

Thanks for your suggestion!

@federicobond
Copy link
ContributorAuthor

Sure! I can try a POC of that. It will probably happen in the weekend though, feeling exhausted these days during the weeks.

rsora reacted with heart emoji

@rsorarsora modified the milestones:0.10.0,0.11.0Apr 14, 2020
@umbynosumbynos modified the milestones:0.11.0,0.12.0Jun 17, 2020
@cmagliecmaglie modified the milestones:0.12.0,0.14.0Sep 14, 2020
@per1234per1234 reopened thisMar 30, 2021
@silvanocerzasilvanocerza removed this from the0.14.0 milestoneMay 11, 2021
@rsorarsora added topic: CLIRelated to the command line interface and removed topic: CLI labelsSep 16, 2021
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

No reviews

Assignees

@rsorarsora

Labels

topic: CLIRelated to the command line interfacetype: enhancementProposed improvement

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

7 participants

@federicobond@rsora@masci@cmaglie@silvanocerza@per1234@umbynos

[8]ページ先頭

©2009-2025 Movatter.jp