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

Rename mimirpb.INVALID error cause into mimirpb.UNKNOWN_CAUSE #6493

Merged
merged 2 commits into from
Oct 26, 2023

Conversation

duricanikolic
Copy link
Contributor

@duricanikolic duricanikolic commented Oct 26, 2023

What this PR does

This PR renames the mimirpb.INVALID symbolic value of type mimirpb.ErrorCause introduced in #6377 into mimirpb.UNKNOWN_CAUSE. The reason for this is that mimirpb.INVALID could be misinterpreted as something that is not valid, but its actual purpose is to represent an unknown error cause.

Which issue(s) this PR fixes or relates to

Relates to #6008

Checklist

  • Tests updated
  • Documentation added
  • CHANGELOG.md updated - the order of entries should be [CHANGE], [FEATURE], [ENHANCEMENT], [BUGFIX]

Signed-off-by: Yuri Nikolic <durica.nikolic@grafana.com>
@duricanikolic duricanikolic self-assigned this Oct 26, 2023
@duricanikolic duricanikolic requested a review from a team as a code owner October 26, 2023 17:49
Copy link
Contributor

@56quarters 56quarters left a comment

Choose a reason for hiding this comment

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

LGTM, thanks!

@@ -709,3 +709,43 @@ func checkErrorWithStatusDetails(t *testing.T, details []any, expectedDetails *m
require.Equal(t, expectedDetails, errDetails)
}
}

Copy link
Contributor

Choose a reason for hiding this comment

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

nit: Feels a bit odd to put methods from a non-test type into the _test.go file. Can you add a comment explaining that this is only needed for tests?

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 have reverted this change, and put the methods back to errors.go with a comment stating that these methods are needed for tests only.

Signed-off-by: Yuri Nikolic <durica.nikolic@grafana.com>
@duricanikolic duricanikolic merged commit 4f9a9b0 into main Oct 26, 2023
28 checks passed
@duricanikolic duricanikolic deleted the yuri/handling-errors-new branch October 26, 2023 20:57
francoposa pushed a commit that referenced this pull request Oct 30, 2023
* Rename mimirpb.INVALID error cause into mimirpb.UNKNOWN_CAUSE

Signed-off-by: Yuri Nikolic <durica.nikolic@grafana.com>

* Fixing review findings

Signed-off-by: Yuri Nikolic <durica.nikolic@grafana.com>

---------

Signed-off-by: Yuri Nikolic <durica.nikolic@grafana.com>
@colega
Copy link
Contributor

colega commented Nov 6, 2023

I can't agree with this change.

The reason for this is that mimirpb.INVALID could be misinterpreted as something that is not valid, but its actual purpose is to represent an unknown error cause.

The reason why I suggested to have an mimirpb.INVALID is to avoid having a valid zero value, that could easily lead to bugs.

With this new version of the code it is unclear when the code is buggy and it didn't set the reason, and when the error was processed and it falls into the "unknown" case.

I'm also not sure when the cause is "Unknown". It seems that we set this into the details of "Unavailable" errors, but maybe in those cases we just shouldn't set any details at all?

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.

3 participants