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

Update primary error functions to take a context, deprecate old functions #1358

Merged
merged 14 commits into from
Jul 30, 2021

Conversation

schristoff
Copy link
Contributor

No description provided.

Copy link
Collaborator

@louisruch louisruch left a comment

Choose a reason for hiding this comment

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

This looks really good! I have one comment about Wrap calling EDeprecated
The only other general comment I would have is that all the test files only test EDeprecated, perhaps if we do add an unexported e that could be used instead...I will look again Monday great work so far!

internal/errors/error.go Outdated Show resolved Hide resolved
@jimlambrt
Copy link
Collaborator

If we are planning to pass a context to Wrap in the future we should also make a WrapDeprecated function now; if we are not planning to pass the context to Wrap, we won’t be able to call E because we don’t have a context in the future. Similar comment on Convert.

+1 on this idea.

Copy link
Collaborator

@jimlambrt jimlambrt left a comment

Choose a reason for hiding this comment

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

Amazing work! I just have a few comments/suggestions.

internal/errors/error.go Outdated Show resolved Hide resolved
internal/errors/error.go Outdated Show resolved Hide resolved
internal/errors/option.go Outdated Show resolved Hide resolved
internal/errors/error.go Show resolved Hide resolved
internal/errors/error.go Show resolved Hide resolved
internal/errors/error.go Show resolved Hide resolved
internal/errors/error.go Show resolved Hide resolved
internal/errors/error.go Show resolved Hide resolved
internal/errors/error_test.go Show resolved Hide resolved
internal/errors/error_test.go Show resolved Hide resolved
@jefferai
Copy link
Member

There are a large number of cases in this PR where there is a context in the function but EDeprecated is used instead of just using the context passed in. It would be good to go through and use the context when available.

Copy link
Collaborator

@louisruch louisruch left a comment

Choose a reason for hiding this comment

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

The WithoutEvent and using context.Todo works well and neatly resolves my concerns around tying us down to never being able to deprecate these functions. ty

@jimlambrt jimlambrt requested a review from louisruch July 29, 2021 15:01
@jimlambrt jimlambrt merged commit 6b78108 into main Jul 30, 2021
@jimlambrt jimlambrt deleted the christoff-write-errorevent branch July 30, 2021 00:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants