Skip to content
This repository has been archived by the owner on Mar 8, 2022. It is now read-only.

Check field type before appending #9

Closed
wants to merge 6 commits into from
Closed

Conversation

ryantxu
Copy link
Member

@ryantxu ryantxu commented Jun 8, 2021

If the input for a field changes we currently panic -- we should do something better than that

@ryantxu ryantxu marked this pull request as draft June 8, 2021 17:30
@leeoniya
Copy link

leeoniya commented Jun 8, 2021

image

@@ -186,14 +214,6 @@ func TestConverter_Convert_NumFrameFields_LabelsColumn(t *testing.T) {
require.JSONEqf(t, string(frameJSON), string(want), "not matched with golden file")
}

func TestConverter_Convert_LabelsColumn_MixedNumberTypes_Panics(t *testing.T) {
Copy link
Member Author

Choose a reason for hiding this comment

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

this tested explicitly that chaning the type panics -- silently replacing with null is not great, but panic seems pretty bad for user enter data

s.fields[index].Append(v)
field := s.fields[index]
if ft != field.Type() {
fmt.Printf("error appending value of type: %v as %v // %v\n", field.Type(), ft, v)
Copy link
Member Author

Choose a reason for hiding this comment

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

@FZambia what is the best logging option here?

Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe pass logger from the outside?

@ryantxu ryantxu requested a review from FZambia June 9, 2021 15:24
@ryantxu ryantxu marked this pull request as ready for review June 9, 2021 15:25
@ryantxu
Copy link
Member Author

ryantxu commented Jun 10, 2021

not necessary... this was moved to grafana core

@ryantxu ryantxu closed this Jun 10, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants