-
-
Notifications
You must be signed in to change notification settings - Fork 390
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
[BREAKING] feat: added details to all init errors #2097
Conversation
bb8236c
to
cbf5187
Compare
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## master #2097 +/- ##
==========================================
+ Coverage 35.01% 35.05% +0.03%
==========================================
Files 232 232
Lines 20560 20560
==========================================
+ Hits 7200 7208 +8
+ Misses 12513 12505 -8
Partials 847 847
Flags with carried forward coverage won't be shown. Click here to find out more.
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report in Codecov by Sentry. |
c31d198
to
f31cc53
Compare
@Bikappa, could you please rebase the PR from the Update Never mind, I did it on https://github.com/kittaakos/arduino-cli/tree/feat/more-error-details |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you!
Two things still need to be fixed. When the library_index.json
is missing, IDE2 expects reason
to be FAILED_INSTANCE_INIT_REASON_LIBRARY_LOAD_ERROR
(4
), but it isn't. All errors when deleting the directories.data
location and initializing the gRPC client.
[
{
"reason": 2,
"message": "Loading index file: loading json index file /Users/a.kitta/Library/Arduino15/package_index.json: open /Users/a.kitta/Library/Arduino15/package_index.json: no such file or directory"
},
{
"reason": 2,
"message": "Loading index file: loading json index file /Users/a.kitta/Library/Arduino15/package_esp8266com_index.json: open /Users/a.kitta/Library/Arduino15/package_esp8266com_index.json: no such file or directory"
},
{
"reason": 2,
"message": "Loading index file: loading json index file /Users/a.kitta/Library/Arduino15/package_esp32_index.json: open /Users/a.kitta/Library/Arduino15/package_esp32_index.json: no such file or directory"
},
{
"reason": 2,
"message": "Loading index file: loading json index file /Users/a.kitta/Library/Arduino15/package_teensy_index.json: open /Users/a.kitta/Library/Arduino15/package_teensy_index.json: no such file or directory"
},
{
"reason": 5,
"message": "discovery builtin:serial-discovery not found"
},
{
"reason": 5,
"message": "discovery builtin:mdns-discovery not found"
},
{
"reason": 2,
"message": "Loading index file: reading library_index.json: open /Users/a.kitta/Library/Arduino15/library_index.json: no such file or directory"
}
]
From the errors 👆, IDE2 does not know if primary package index loading has failed or if it's a 3rd party platform.
daac471
to
ef5cbe2
Compare
@kittaakos the error code has been updated to be the one you expect. In regards to the kind of origin (builtin or 3rd) party, I tried looking into the code, but it turns out to be easier said than done. The current logic has to be stretched out quite a bit in order to collect the info about the origin and bring it to the output. I also don't know if we really want to maintain that. I propose to merge this as-is now and start thinking about a common error source design that provides structured metadata for non-human clients. For example:
It would then be up to the client to define their own heuristic on the software status and wether or not it is operable for their purposes. |
Thank you, @Bikappa
IDE2 needs to decide somehow.
Sure, I will discard my review, and you can proceed with the merge. On the other hand, IDE2 would be the only client of this API but cannot use it, so merging this PR does not change anything.
IDE2 has been waiting for this since day one. I am sure there could be a more sophisticated way of propagating application-specific errors between IDE2 and CLI, but surely adding another enum type |
Surely it looks an easy design, but, maybe not for this specific one, several errors come to the initialisation logic similarly to how clients see them: as a black-box "error" thing that has a message. And these are just forwarded. |
I think this will be solved when we fix #1529: it basically requires that the first |
#1529 should have made the Init process much simpler and removed the need for most of the error code exposed here. |
Please check if the PR fulfills these requirements
See how to contribute
before creating one)
our contributing guidelines
UPGRADING.md
has been updated with a migration guide (for breaking changes)configuration.schema.json
updated if new parameters are added.What kind of change does this PR introduce?
Iterates on #2076 adding details to more errors in the instance initialization flow
What is the current behavior?
One case of index loading error and some other error scenarios do not have details
Platform loading errors are not reported as initialization errors
What is the new behavior?
All init errors have a the corresponding details
Platform errors are wrapped into init errors and given a dedicated reason
Does this PR introduce a breaking change, and is titled accordingly?
Yes,
PlatformLoadingError
disappear as gprc type. Initialization errors related to platform loads now are have a detail of typeFailedInstanceInitError
as in the example above.Other information
Relates to #1762