-
Notifications
You must be signed in to change notification settings - Fork 25
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
fix: Improve error wrapping #512
Conversation
if err := eg.Wait(); err != nil { | ||
return fmt.Errorf("got EOF. failed to wait for plugin: %w", err) | ||
return fmt.Errorf("got EOF. plugin returned: %w", err) |
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.
EOF
is not an error necessarily (it usually means the stream was closed), so I'm not sure we want to report it (we can log it instead as Debug
). Also to be consistent we should add plugin returned
to everywhere we do eg.Wait()
, like lines 105
and 114
in this file.
You can see https://github.com/cloudquery/plugin-sdk/pull/461/files for reference.
We can also reduce the nesting of handling EOF
, but that can be done in another PR, see #463 for reference
case ch <- clientResource: | ||
} | ||
} | ||
|
||
close(ch) | ||
if err := eg.Wait(); err != nil { | ||
return err | ||
return fmt.Errorf("write client returned: %w", err) |
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.
return fmt.Errorf("write client returned: %w", err) | |
return fmt.Errorf("write client failed with error: %w", err) |
Also shouldn't we use the same message above, i.e. instead plugin returned
-> write failed
An additional comment on this. gRPC doesn't support error wrapping, so using |
Closing as this was addressed in additional PR. |
No description provided.