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

WriteAPIBlocking discards http2.Error content #293

Closed
pabigot opened this issue Dec 22, 2021 · 0 comments · Fixed by #294
Closed

WriteAPIBlocking discards http2.Error content #293

pabigot opened this issue Dec 22, 2021 · 0 comments · Fixed by #294

Comments

@pabigot
Copy link
Contributor

pabigot commented Dec 22, 2021

The fixes for issue #235 included:

if err != nil {
return err.Unwrap()
}
which unwraps the error returned from the lower levels.

When the error is an http2.Error, e.g. because the token is unauthorized, this invokes:

func (e *Error) Unwrap() error {
return errors.New(e.Error())
}
which completely discards all the Influx-specific information, producing an error of type errors.errorString that has nothing but the text.

So, unlike the non-blocking API, an error from WriteAPIBlocking() does not return an http2.Error, making it complex to understand why the write failed. The idiom proposed in #292 (comment) cannot recover the lost information.

pabigot added a commit to pabigot/influxdb-client-go that referenced this issue Dec 22, 2021
pabigot added a commit to pabigot/influxdb-client-go that referenced this issue Dec 22, 2021
pabigot added a commit to pabigot/influxdb-client-go that referenced this issue Dec 22, 2021
pabigot added a commit to pabigot/influxdb-client-go that referenced this issue Dec 22, 2021
vlastahajek added a commit that referenced this issue Jan 4, 2022
fix: retain full error information for blocking writes (#293)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant