-
Notifications
You must be signed in to change notification settings - Fork 537
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
Wrap connection network errors #646
Wrap connection network errors #646
Conversation
Was concerned that this is a breaking change because
As a result I think we are OK with this. However the change does add quite a bit of code which, as you say, is not required if we drop support for earlier versions of Go. With the release of 1.21 I don't have a problem with following the Go team policy and only supporting 1.20 and 1.21. As such might I suggest that we go with the simpler version and Go 1.20? (I would accept into |
I have converted this PR to the Go 1.20 multi wrap format, and updated the minimum Go version to 1.20, along with the dependencies. I have tested if everything still works fine in case the I would argue that this error was generally just a string, not really comparable, and we can break the format and only wrap when |
This MR contains the following updates: | Package | Type | Update | Change | |---|---|---|---| | [github.com/eclipse/paho.mqtt.golang](https://github.com/eclipse/paho.mqtt.golang) | require | minor | `v1.4.3` -> `v1.5.0` | --- ### Release Notes <details> <summary>eclipse/paho.mqtt.golang (github.com/eclipse/paho.mqtt.golang)</summary> ### [`v1.5.0`](https://github.com/eclipse/paho.mqtt.golang/releases/tag/v1.5.0) [Compare Source](eclipse-paho/paho.mqtt.golang@v1.4.3...v1.5.0) In the year since the release of v1.4.3 the majority of changes have been small incremental improvements/fixes. One notable change is that Go v1.20+ is now required (due to MR [#​646](eclipse-paho/paho.mqtt.golang#646)). #### What's Changed - Wrap connection network errors by [@​adriansmares](https://github.com/adriansmares) in eclipse-paho/paho.mqtt.golang#646 - Clarify use of token.WaitTimeout by [@​MattBrittan](https://github.com/MattBrittan) in eclipse-paho/paho.mqtt.golang#659 - fix ([#​661](eclipse-paho/paho.mqtt.golang#661)): Add NewClientOptionsReader for mocking purposes. by [@​avmunm](https://github.com/avmunm) in eclipse-paho/paho.mqtt.golang#662 - fix: fix keep-alive timeouts on small intervals by [@​lefinal](https://github.com/lefinal) in eclipse-paho/paho.mqtt.golang#667 - Replace the time.After with the timer for efficiency. by [@​DVasselli](https://github.com/DVasselli) in eclipse-paho/paho.mqtt.golang#671 - fix: deprecation warnings for ioutil by [@​vruge](https://github.com/vruge) in eclipse-paho/paho.mqtt.golang#665 - fix: issue 675:goroutine leak when connectionUp(true) return error by [@​kiqi007](https://github.com/kiqi007) in eclipse-paho/paho.mqtt.golang#678 - Update dependencies by [@​MattBrittan](https://github.com/MattBrittan) in eclipse-paho/paho.mqtt.golang#683 #### New Contributors - [@​adriansmares](https://github.com/adriansmares) made their first contribution in eclipse-paho/paho.mqtt.golang#646 - [@​avmunm](https://github.com/avmunm) made their first contribution in eclipse-paho/paho.mqtt.golang#662 - [@​lefinal](https://github.com/lefinal) made their first contribution in eclipse-paho/paho.mqtt.golang#667 - [@​DVasselli](https://github.com/DVasselli) made their first contribution in eclipse-paho/paho.mqtt.golang#671 - [@​vruge](https://github.com/vruge) made their first contribution in eclipse-paho/paho.mqtt.golang#665 - [@​kiqi007](https://github.com/kiqi007) made their first contribution in eclipse-paho/paho.mqtt.golang#678 **Full Changelog**: eclipse-paho/paho.mqtt.golang@v1.4.3...v1.5.0 </details> --- - [ ] <!-- rebase-check -->If you want to rebase/retry this MR, check this box --- <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzOC44MC4wIiwidXBkYXRlZEluVmVyIjoiMzguODAuMCIsInRhcmdldEJyYW5jaCI6Im1hc3RlciIsImxhYmVscyI6W119--> See merge request alpine/infra/build-server-status!15
This PR implements error wrapping for the connection network errors, in order to allow them to be asserted using the errors package, specifically errors.Is.
Pretty much all of the boiler plate proposed in this PR can be handled using Go 1.20 multiple error wrapping, but since that's a 1.20+ feature, we manually handle this instead. When Go 1.20 becomes the minimum supported version, most of this PR can be reduced to
fmt.Errorf("%w : %w", packets.ConnErrors[rc], err)
.Some formatting is changed due to the fact that I automatically format files using gofumpt - please let me know if you would like for these changes to be left out.