Skip to content

Conversation

@ermyar
Copy link
Collaborator

@ermyar ermyar commented Oct 27, 2025

Returing wrapped context.Cause(ctx) error in <-ctx.Done() case. Allows compare errors using errors.Is/As.

Fixes #457

I didn't forget about (remove if it is not applicable):

@ermyar ermyar linked an issue Oct 27, 2025 that may be closed by this pull request
@ermyar ermyar force-pushed the ermyar/gh-457_returning_ctx_cause_error branch from 81db13b to dc57834 Compare October 27, 2025 14:49
@ermyar ermyar requested a review from oleg-jukovec October 27, 2025 14:54
@ermyar ermyar marked this pull request as ready for review October 27, 2025 15:03
Copy link
Collaborator

@oleg-jukovec oleg-jukovec left a comment

Choose a reason for hiding this comment

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

Please, validate and update other places of a context usage:

$ grep "ctx.Done" -r connection.go
		case <-ctx.Done():
		case <-ctx.Done():
	case <-ctx.Done():

@bigbes
Copy link
Collaborator

bigbes commented Oct 27, 2025

Single comment, otherwise LGTM.

@ermyar ermyar requested a review from oleg-jukovec October 27, 2025 17:20
Copy link
Collaborator

@oleg-jukovec oleg-jukovec left a comment

Choose a reason for hiding this comment

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

@ermyar ermyar force-pushed the ermyar/gh-457_returning_ctx_cause_error branch 3 times, most recently from 5a216c1 to c6bde15 Compare October 27, 2025 21:31
@ermyar ermyar requested review from bigbes and oleg-jukovec October 28, 2025 04:50
@oleg-jukovec
Copy link
Collaborator

oleg-jukovec commented Oct 28, 2025

Please, rebase the branch on the master branch and resolve conflicts.

Copy link
Collaborator

@oleg-jukovec oleg-jukovec left a comment

Choose a reason for hiding this comment

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

Please, update a link to an issue in the commit message and in the PR message:

Fixes (457)

->

Fixes #457

Returing wrapped context.Cause(ctx) error in <-ctx.Done() case.
Allows compare errors using errors.Is/As.
Add 3 tests errors checking comparabily.

Fixes #457
@ermyar ermyar force-pushed the ermyar/gh-457_returning_ctx_cause_error branch from c6bde15 to 35dd810 Compare October 28, 2025 09:41
@ermyar ermyar requested a review from oleg-jukovec October 28, 2025 10:08
@oleg-jukovec oleg-jukovec merged commit 57dc833 into master Oct 28, 2025
27 checks passed
@oleg-jukovec oleg-jukovec deleted the ermyar/gh-457_returning_ctx_cause_error branch October 28, 2025 11:59
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 this pull request may close these issues.

v3: return context error after it is done

4 participants