-
Notifications
You must be signed in to change notification settings - Fork 17.7k
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
syscall: add DLLError.Unwrap() method [freeze exception] #42584
Comments
Change https://golang.org/cl/269761 mentions this issue: |
Change https://golang.org/cl/269937 mentions this issue: |
Because we're expecting for future functions to be unavailable, we should add an Unwrap() function to the DLLError struct, so that people can test for this situation easily via: if errors.Is(err, windows.ERROR_PROC_NOT_FOUND) { ... } DLLError already was wrapping the underlying Errno error, but never got the Go 1.13 helper method. Update golang/go#42584 Change-Id: Ib916ddd55a2de29f988edaaf82f2ae0ce1b18e3b Reviewed-on: https://go-review.googlesource.com/c/sys/+/269937 Trust: Jason A. Donenfeld <[email protected]> Run-TryBot: Jason A. Donenfeld <[email protected]> TryBot-Result: Go Bot <[email protected]> Reviewed-by: Brad Fitzpatrick <[email protected]>
Changing the title, as things are now handled with x/sys/windows. |
@zx2c4 thank you for creating this issue. I adjusted your issue title so it looks like proposal https://github.com/golang/proposal#the-proposal-process I also fiddled with the labels. Hopefully I did correct thing. Now we wait for proposal decision. Even if this proposal is accepted, I doubt we will be able to implement this until Go 1.16 is released. Alex |
This seems OK and it would be better to be consistent with x/sys. Looking in the API files, I see these remaining without Unwrap methods: go1.txt:230:pkg compress/flate, type ReadError struct, Err error And those are marked "Deprecated, no longer returned". Let's fix it. |
Because it is trivial and consistent with everything else, we can just approve this. Accepted. |
Great. I'll submit https://go-review.googlesource.com/c/go/+/269761/ whenever you want to +2 it. |
@rsc @golang/release There is https://go-review.googlesource.com/c/go/+/269761/ that implements this change. The CL was submitted after Go 1.16 freeze started. I propose we submit the CL now for Go 1.16. The change is trivial. And according to @rsc #42584 (comment) the change was What do you think? Alex |
@alexbrainman Thanks for making this freeze exception request and providing a rationale. I am approving this for Go 1.16. The change is trivial and should not add significant delay or increase risk for the release. (It's also easy to revert if we learn of serious problems that cannot be resolved in time.) |
These older structs embed a wrapped error. But because they're old, they haven't defined an
Unwrap()
method. We should do this, so that users can check for issues such asif errors.Is(err, windows.ERROR_PROC_NOT_FOUND) { ... }
, which is becoming more important as Microsoft keeps adding APIs.The text was updated successfully, but these errors were encountered: