-
-
Notifications
You must be signed in to change notification settings - Fork 394
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
feat: specialize init errors #2076
Conversation
d0d356d
to
e434f2d
Compare
Codecov ReportBase: 36.56% // Head: 36.49% // Decreases project coverage by
Additional details and impacted files@@ Coverage Diff @@
## master #2076 +/- ##
==========================================
- Coverage 36.56% 36.49% -0.07%
==========================================
Files 229 229
Lines 19538 19570 +32
==========================================
- Hits 7144 7143 -1
- Misses 11555 11587 +32
- Partials 839 840 +1
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 at Codecov. |
dc0054c
to
ab533d1
Compare
ab533d1
to
52f3cb2
Compare
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.
👍🏼
Hi, thanks for moving the request forward. IDE2 is eager to try it out (arduino/arduino-ide#1925 (comment)). I do not understand something. Can you please help? There is no error when the library index is missing. I am unfamiliar with the go code, but maybe here. When I wipe my rpcurl \
-plaintext \
-import-path ./rpc \
-proto cc/arduino/cli/commands/v1/commands.proto \
127.0.0.1:50051 \
cc.arduino.cli.commands.v1.ArduinoCoreService.Create {
"instance": {
"id": 1
}
} grpcurl \
-plaintext \
-import-path ./rpc \
-proto cc/arduino/cli/commands/v1/commands.proto \
-d '{"instance": {"id": 1}}' \
127.0.0.1:50051 \
cc.arduino.cli.commands.v1.ArduinoCoreService.Init {
"error": {
"code": 9,
"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",
"details": [
{"@type":"type.googleapis.com/cc.arduino.cli.commands.v1.FailedInstanceInitError","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":"FAILED_INSTANCE_INIT_REASON_INDEX_LOAD_ERROR"}
]
}
}
{
"error": {
"code": 9,
"message": "Error loading hardware platform: discovery builtin:serial-discovery not found",
"details": [
{"@type":"type.googleapis.com/cc.arduino.cli.commands.v1.PlatformLoadingError"}
]
}
}
{
"error": {
"code": 9,
"message": "Error loading hardware platform: discovery builtin:mdns-discovery not found",
"details": [
{"@type":"type.googleapis.com/cc.arduino.cli.commands.v1.PlatformLoadingError"}
]
}
}
{
"error": {
"code": 9,
"message": "Loading index file: reading library_index.json: open /Users/a.kitta/Library/Arduino15/library_index.json: no such file or directory"
}
} 👆 Notice the missing Why does the CLI distinguish between {
"code": 9,
"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",
"detailsList": [
{
"typeUrl": "type.googleapis.com/cc.arduino.cli.commands.v1.FailedInstanceInitError",
"value": "CAIStAFMb2FkaW5nIGluZGV4IGZpbGU6IGxvYWRpbmcganNvbiBpbmRleCBmaWxlIC9Vc2Vycy9hLmtpdHRhL0xpYnJhcnkvQXJkdWlubzE1L3BhY2thZ2VfaW5kZXguanNvbjogb3BlbiAvVXNlcnMvYS5raXR0YS9MaWJyYXJ5L0FyZHVpbm8xNS9wYWNrYWdlX2luZGV4Lmpzb246IG5vIHN1Y2ggZmlsZSBvciBkaXJlY3Rvcnk="
}
]
} {
"code": 9,
"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",
"detailsList": [
{
"typeUrl": "type.googleapis.com/cc.arduino.cli.commands.v1.FailedInstanceInitError",
"value": "CAISwgFMb2FkaW5nIGluZGV4IGZpbGU6IGxvYWRpbmcganNvbiBpbmRleCBmaWxlIC9Vc2Vycy9hLmtpdHRhL0xpYnJhcnkvQXJkdWlubzE1L3BhY2thZ2VfdGVlbnN5X2luZGV4Lmpzb246IG9wZW4gL1VzZXJzL2Eua2l0dGEvTGlicmFyeS9BcmR1aW5vMTUvcGFja2FnZV90ZWVuc3lfaW5kZXguanNvbjogbm8gc3VjaCBmaWxlIG9yIGRpcmVjdG9yeQ=="
}
]
} Can CLI have a more expressive name for the |
When does the CLI provide the {
"error": {
"code": 9,
"message": "Error loading hardware platform: discovery builtin:serial-discovery not found",
"details": [
{"@type":"type.googleapis.com/cc.arduino.cli.commands.v1.PlatformLoadingError"}
]
}
} I would expect something like this: {
"error": {
"code": 9,
"message": "Error loading hardware platform: discovery builtin:serial-discovery not found",
"details": [
{"@type":"type.googleapis.com/cc.arduino.cli.commands.v1.FailedInstanceInitError","message":"Error loading hardware platform: discovery builtin:serial-discovery not found","reason":"FAILED_INSTANCE_INIT_REASON_TOOL_LOAD_ERROR"}
]
}
} From the docs:
|
Hi @kittaakos,
it was left behind in this category. I'm preparing a follow up pr for it. If I understand correctly you are suggesting to wrap
I like the approach and I'm including it in the aforementioned follow-up pr. But if further differentiation is desired from the CLI output: like different types of |
Thanks for the reply, @Bikappa!
From the API's perspective, it does not matter how you name the error type in Go, but there is an API type
Thank you!
I put it like this, IDE2 needs to detect two distinct errors during the InitRequest:
IDE2 can try out any proposed CLI changes from a PR, so when such a changeset is ready, I highly recommend trying it out before the merge. |
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)What kind of change does this PR introduce?
Makes some errors easier to recognize, with no text parsing, on the client side.
What is the current behavior?
Most of the errors follow the standard grpc error model which is limited around the structure of data it carries.
What is the new behavior?
More errors in the instance initialization logic now have a richer standard that allows them to be easily machine-recognizable on the client side
Does this PR introduce a breaking change, and is titled accordingly?
Other information
Fixes #1762 (at least in its original demand, a following initiative should be pursued to make all errors following a richer standard)