-
Notifications
You must be signed in to change notification settings - Fork 9.4k
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
Improve github issue title #992
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -35,6 +35,8 @@ document.addEventListener('DOMContentLoaded', _ => { | |
const optionsList = document.body.querySelector('.options__list'); | ||
const okButton = document.getElementById('ok'); | ||
|
||
const MAX_ISSUE_ERROR_LENGTH = 60; | ||
|
||
function getLighthouseVersion() { | ||
return chrome.runtime.getManifest().version; | ||
} | ||
|
@@ -53,7 +55,11 @@ document.addEventListener('DOMContentLoaded', _ => { | |
qsBody += '**Stack Trace**:\n ```' + err.stack + '```'; | ||
|
||
const base = 'https://github.com/googlechrome/lighthouse/issues/new?'; | ||
const title = encodeURI('title=Extension Error: ' + err.message); | ||
let titleError = err.message; | ||
if (titleError.length > MAX_ISSUE_ERROR_LENGTH) { | ||
titleError = err.message.substring(0, MAX_ISSUE_ERROR_LENGTH - 3) + '...'; | ||
} | ||
const title = encodeURI('title=Extension Error: ' + titleError); | ||
const body = '&body=' + encodeURI(qsBody); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I feel like this would benefit from some upper bound truncation in case the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. +1 on truncation. We don't gain much after the first line and the entire message is already in the body. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @addyosmani @ebidel Done, and now this PR truncates appened error messages at 60 characters. |
||
|
||
reportErrorEl.href = base + title + body; | ||
|
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.
use
titleError
:titleError = `${titleError.substring(0, MAX_ISSUE_ERROR_LENGTH - 3)}...`;
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.
@ebidel 👍 concatenation replaced with template literal