Skip to content

Conversation

@brizental
Copy link
Contributor

The second commit (008bce4) is a bonus. I am not sure that is a good pattern, but it does centralize payload validation instead of doing it in a bunch of different places and in different ways, and I think that at least is good. Please let me know what you think :)

@brizental brizental requested a review from Dexterp37 December 16, 2020 13:47
const transformFn = ((amount) => {
return (v?: CounterMetricPayload): CounterMetricPayload => {
let result = v ? v + amount : amount;
if (result > Number.MAX_SAFE_INTEGER) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Does this change the maximum representable number compared to the SDK?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good question, let me check... Actually is much larger then the maximum representable number on the SDK:

  • Javascript: 9007199254740991
  • Rust: 4294967295

@brizental brizental requested a review from Dexterp37 December 16, 2020 15:09
I was letting errors pass because they were only warning and I didn't
see them. This is easier than overwriting every recommended rule that is
a warning into an error.
@brizental brizental merged commit f17b4eb into mozilla:main Dec 17, 2020
@brizental brizental deleted the 1679380-counter branch December 17, 2020 08:44
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