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

Get rid of validation/errors.go #6955

Merged
merged 3 commits into from
Dec 18, 2023
Merged

Conversation

duricanikolic
Copy link
Contributor

What this PR does

This PR gets rid of validation/errors.go. This source contained different functions creating an instance of validation.LimitError, but most callers of of those errors called their Error() functions immediately after the creation. These usages have been replaced with a more appropriate methods placed in the package of the caller.

Checklist

  • Tests updated.
  • [na] Documentation added.
  • [na] CHANGELOG.md updated - the order of entries should be [CHANGE], [FEATURE], [ENHANCEMENT], [BUGFIX].
  • [na] about-versioning.md updated with experimental features.

@duricanikolic duricanikolic self-assigned this Dec 18, 2023
@duricanikolic duricanikolic marked this pull request as ready for review December 18, 2023 14:48
@duricanikolic duricanikolic requested a review from a team as a code owner December 18, 2023 14:48
Copy link
Contributor

Choose a reason for hiding this comment

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

i'm not super sure we need these tests. I see you carried them over from the validation package, but they just assert that the hardcoded string is the same as what's in the test. I don't see a ton of value in them

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I put these tests there just for completeness, since in every package where we have errors.go, we also have errors_test.go. But if you prefer to get rid of them, I will do that.

Copy link
Contributor

Choose a reason for hiding this comment

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

my preference is for removing them; i don't think they will catch any bugs

Signed-off-by: Yuri Nikolic <[email protected]>
@duricanikolic duricanikolic force-pushed the yuri/handling-ingester-errors branch from b6c8dc5 to 6abfabf Compare December 18, 2023 16:33
Comment on lines 35 to 39
func limitErrorFunc(format string) func(uint64) validation.LimitError {
return func(limit uint64) validation.LimitError {
return validation.LimitError(fmt.Sprintf(format, limit))
}
}
Copy link
Contributor

Choose a reason for hiding this comment

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

and at this point can't limitErrorFunc become limitError

func limitError(format string, limit uint64) validation.LimitError {
	return validation.LimitError(fmt.Sprintf(format, limit))
}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You are right, it can. Will fix it right now

Signed-off-by: Yuri Nikolic <[email protected]>
Copy link
Contributor

@dimitarvdimitrov dimitarvdimitrov left a comment

Choose a reason for hiding this comment

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

LGTM

@duricanikolic duricanikolic merged commit 72d49a6 into main Dec 18, 2023
@duricanikolic duricanikolic deleted the yuri/handling-ingester-errors branch December 18, 2023 17:34
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.

2 participants