-
Notifications
You must be signed in to change notification settings - Fork 573
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
fix: abridge call graph creation error messages in analytics #1279
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
return msg; | ||
} | ||
const e = ellipsis || ' ... '; | ||
const toKeep = (maxLen - e.length) / 2; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think toKeep
can be a not whole number
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know. But it seems to round it when used in slice
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it would be better to round it before, less JS magic
if (msg.length <= maxLen) { | ||
return msg; | ||
} | ||
const e = ellipsis || ' ... '; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe have it as an optional param on line 4?
ellipsis = '...': string
,
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is that supported by TypeScript?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Optional parameters? in JS and TS
analytics.add('callGraphError', err.innerError.toString()); | ||
analytics.add( | ||
'callGraphError', | ||
abridgeErrorMessage( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should go also to the test file?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Testing that method would be quite involved, and the functional tests for abridging the string should cover a reasonable number of cases.
analytics.add('callGraphError', err.innerError.toString()); | ||
analytics.add( | ||
'callGraphError', | ||
abridgeErrorMessage( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it would be nice to say why we are doing this trimming with a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That is pretty self-explanatory from the code, no? E.g. ANALYTICS_PAYLOAD_MAX_LENGTH
🎉 This PR is included in version 1.364.2 🎉 The release is available on: Your semantic-release bot 📦🚀 |
What does this PR do?
Since the call graph error messages can get pretty big, abridge them to something more manageable. This keep the beginning, and end of the message since, presumably, that's where the most important details are.