Skip to content

rados: Implement Unwrap for OperationError#1222

Merged
mergify[bot] merged 1 commit into
ceph:masterfrom
dszoboszlay:unwrap-for-operationerror
Feb 3, 2026
Merged

rados: Implement Unwrap for OperationError#1222
mergify[bot] merged 1 commit into
ceph:masterfrom
dszoboszlay:unwrap-for-operationerror

Conversation

@dszoboszlay

Copy link
Copy Markdown
Contributor

Exposing the operation and step errors wrapped by the OperationError makes it possible to use for example errors.Is to check the underlying error, and handle it properly.

Checklist

  • Added tests for features and functional changes
  • Public functions and types are documented → I didn't document Unwrap because Error isn't documented either. These are quite well-known methods for Go errors.
  • Standard formatting is applied to Go code
  • Is this a new API? Added a new file that begins with //go:build ceph_previewOperationError.Unwrap is technically a new API, but I don't believe it should be tagged as preview. Implementing this API for the OperationError type is more like a bug fix than a new feature.
  • Ran make api-update to record new APIs

@phlogistonjohn phlogistonjohn added the API This PR includes a change to the public API of a go-ceph package label Jan 19, 2026
@phlogistonjohn

Copy link
Copy Markdown
Collaborator

I didn't document Unwrap because Error isn't documented either. These are quite well-known methods for Go errors.

That's fine by me.

OperationError.Unwrap is technically a new API, but I don't believe it should be tagged as preview. Implementing this API for the OperationError type is more like a bug fix than a new feature.

Preview is mainly there for public APIs to appear in a released version of the code but gives us an opportunity to change things if something gets noticed and needs updating during that preview period. In that case we're able to make a direct change instead of trying to deprecate and remove something people might have put into production. It's a silly example but what if someone complained that it should be Unwrap() error vs. Unwrap() []error ** we'd have an opportunity to have a discussion around that.

Regardless, I'm not unwilling to make an exception for this but I think I'd want the other maintainers to chime in on that. ^ @anoopcs9 @ansiwen

** Since I just learned Go supports this. :-)

@anoopcs9 anoopcs9 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OperationError.Unwrap is technically a new API, but I don't believe it should be tagged as preview. Implementing this API for the OperationError type is more like a bug fix than a new feature.

It's a silly example but what if someone complained that it should be Unwrap() error vs. Unwrap() []error ** we'd have an opportunity to have a discussion around that.

I wouldn't mind much. After all we are just adding to what's already returned as an error. I hope there isn't a case where there are StepErrors but OpError is empty.

** Since I just learned Go supports this. :-)

You are not alone 😀.

@dszoboszlay

Copy link
Copy Markdown
Contributor Author

Regardless, I'm not unwilling to make an exception for this but I think I'd want the other maintainers to chime in on that.

Thanks for the explanation of your process! In this case I'm not defining a new API, but essentially implementing an optional method of an already defined interface from the standard library, so there's not much to debate about how anyone wants it to look like.

However, if the maintainers would prefer, I'm open to moving it out to a preview file of course.

I hope there isn't a case where there are StepErrors but OpError is empty.

I took care of omitting OpError in case it would be nil. 😉

@phlogistonjohn

Copy link
Copy Markdown
Collaborator

I'll officially +1 an exception to add this function without being a preview API first.

@anoopcs9 it sounds like you are ok with it too, can you confirm?

@ansiwen is not as active on this project lately and so I suggest waiting until Fri if he's got a reason to NACK it. But if we don't hear back by then and Anoop and I are OK with it we can move forward with that. (And even after the PR is merged we have wiggle room to adjust plans up until the next release day.)

anoopcs9
anoopcs9 previously approved these changes Jan 20, 2026
@anoopcs9 anoopcs9 added the extended-review A submitter or reviewer feels the PR needs an extended review period label Jan 21, 2026
@anoopcs9

Copy link
Copy Markdown
Collaborator

@Mergifyio rebase

@mergify

mergify Bot commented Jan 30, 2026

Copy link
Copy Markdown
Contributor

rebase

❌ Pull request can't be updated with latest base branch changes

Details

This pull request seems to come from a fork, and Mergify needs the author's permission to update its branch.
The author needs to enable "Allow edits from maintainers" on this pull request, or update the branch manually.

@anoopcs9

Copy link
Copy Markdown
Collaborator

rebase

❌ Pull request can't be updated with latest base branch changes

Details

This pull request seems to come from a fork, and Mergify needs the author's permission to update its branch. The author needs to enable "Allow edits from maintainers" on this pull request, or update the branch manually.

@dszoboszlay Can you please rebase the change?

@anoopcs9 anoopcs9 removed the extended-review A submitter or reviewer feels the PR needs an extended review period label Jan 30, 2026
Exposing the operation and step errors wrapped by the OperationError
makes it possible to use for example errors.Is to check the underlying
error, and handle it properly.

Signed-off-by: Dániel Szoboszlay <dszoboszlay@evroc.com>
@dszoboszlay dszoboszlay force-pushed the unwrap-for-operationerror branch from 5292aeb to f9abe76 Compare January 30, 2026 20:39
@mergify mergify Bot dismissed anoopcs9’s stale review January 30, 2026 20:39

Pull request has been modified.

@dszoboszlay

Copy link
Copy Markdown
Contributor Author

@dszoboszlay Can you please rebase the change?

Done! (Sorry, I had the Allow edits by maintainers check box ticked, don't know why wasn't that enough.)

@phlogistonjohn

Copy link
Copy Markdown
Collaborator

It's mergify - they changed their configs (again) and I don't feel they do a good job of documenting the changes and it's hard to keep up.

@mergify mergify Bot added the queued label Feb 3, 2026
@mergify mergify Bot merged commit a806a7c into ceph:master Feb 3, 2026
16 of 17 checks passed
@mergify

mergify Bot commented Feb 3, 2026

Copy link
Copy Markdown
Contributor

Merge Queue Status

✅ The pull request has been merged at f9abe76

This pull request spent 7 seconds in the queue, with no time running CI.
The checks were run in-place.

Required conditions to merge
  • #approved-reviews-by >= 1 [🛡 GitHub branch protection]
  • #changes-requested-reviews-by = 0 [🛡 GitHub branch protection]
  • any of [🛡 GitHub branch protection]:
    • check-success = check
    • check-neutral = check
    • check-skipped = check
  • any of [🛡 GitHub branch protection]:
    • check-success = test-suite (pacific)
    • check-neutral = test-suite (pacific)
    • check-skipped = test-suite (pacific)
  • any of [🛡 GitHub branch protection]:
    • check-success = test-suite (quincy)
    • check-neutral = test-suite (quincy)
    • check-skipped = test-suite (quincy)
  • any of [🛡 GitHub branch protection]:
    • check-success = test-suite (reef)
    • check-neutral = test-suite (reef)
    • check-skipped = test-suite (reef)
  • any of [🛡 GitHub branch protection]:
    • check-success = test-suite (squid)
    • check-neutral = test-suite (squid)
    • check-skipped = test-suite (squid)

@mergify mergify Bot removed the queued label Feb 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

API This PR includes a change to the public API of a go-ceph package

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants