-
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
Extension: add report error button #944
Conversation
CLAs look good, thanks! |
Thanks for the PR! I'll take a closer look at it shortly, but just as a quick drive by comment on the screenshot in #919, we'll definitely want the plugin and Chrome versions included in the bug report body. Looks like you may have to parse the UA string to get the Chrome version (unless there's an extension API I'm missing), and you may need to pipe in the extension version through the background page. |
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.
In addition to the version numbers, we probably want the full error stack as well. Many of the error messages we give won't be enough to diagnose the problem the user is seeing
|
||
const base = 'https://github.com/googlechrome/lighthouse/issues/new?'; | ||
const title = 'title=Lighthouse%20Extension%20Error'; | ||
const body = '&body=Error:%20' + message; |
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.
the two cases handled by if
statements above (devtools open and multiple tabs) should not trigger the report error button, since they're local things the user needs to fix
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.
Good catch, thank ya!
const body = '&body=Error:%20' + message; | ||
|
||
reportErrorEl.href = base + title + body; | ||
reportErrorEl.text = 'Report Error'; |
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.
.text -> .textContent incase we use something other than HTMLAnchorElement in the future.
@ebidel @brendankenny
|
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.
looking good. Just some small style things left from me
@@ -37,6 +37,32 @@ document.addEventListener('DOMContentLoaded', _ => { | |||
const optionsList = document.body.querySelector('.options__list'); | |||
const okButton = document.getElementById('ok'); | |||
|
|||
function getLightHouseVersion() { |
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.
nit: we aren't always consistent with this, but lighthouse is one word, so should be getLighthouseVersion()
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.
Done!
@@ -37,6 +37,32 @@ document.addEventListener('DOMContentLoaded', _ => { | |||
const optionsList = document.body.querySelector('.options__list'); | |||
const okButton = document.getElementById('ok'); | |||
|
|||
function getLightHouseVersion() { | |||
return chrome.runtime.getManifest().version; |
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.
nice find!
|
||
function buildReportErrorLink(err) { | ||
const reportErrorEl = document.createElement('a'); | ||
reportErrorEl.className = 'button button--report-error'; |
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 have @robdodson in my head saying "just use a button" here. Should this be just a button? Alternatively we could make the link more link-like.
I don't want to bikeshed here too much, we can always change it up later if we don't get it exactly right at first. @ebidel for a quick opinion.
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.
A button would be consistent with the existing HTML buttons, but would have a few small hoops to jump through, i.e. storing the link on a data-issue-link
attribute and binding an onclick function to the button. Nothing too crazy, but a link was easiest 😄
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.
in general buttons are for actions and links are for navigation. Not sure what the intent of this control is but happy to take a look in-person if that's any help
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.
yeah, my point was more styling. It's a link acting like a link, but somewhat styled like a button :)
However, it works and we've talked about reworking the popup as it keeps getting more crowded anyways, so we can address this at that point if need be. I'd like to get this landed now to help users out.
|
||
let qsBody = '**Lighthouse Version**: ' + getLightHouseVersion() + '\n'; | ||
qsBody += '**Chrome Version**: ' + getChromeVersion() + '\n'; | ||
qsBody += '**Stack Trace**:\n' + err.stack; |
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.
nit: possible to surround the stack with `````s to turn it into a code block?
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.
Good call and done. After placing it in a code block, I noticed the original error wasn't in the stack trace, so I also added that.
Think a link is fine because it's action is a URL taking you to a webpage. On Wed, Nov 16, 2016, 1:17 AM Nick Olinger notifications@github.com wrote:
|
@@ -51,7 +51,8 @@ document.addEventListener('DOMContentLoaded', _ => { | |||
|
|||
let qsBody = '**Lighthouse Version**: ' + getLightHouseVersion() + '\n'; | |||
qsBody += '**Chrome Version**: ' + getChromeVersion() + '\n'; | |||
qsBody += '**Stack Trace**:\n' + err.stack; | |||
qsBody += '**Error Message**: ' + err.message + '\n'; | |||
qsBody += '**Stack Trace**:\n ```' + err.stack + '```'; |
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.
The URL the user was running LH against would also be helpful to add to the bug report.
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 thought about that, but is thought it could be considered invasive. Thoughts?
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.
Perhaps we could have a placeholder for them to fill in?
**URL:\n**: <Enter the URL that caused this error>
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.
yeah, it could be invasive. Most of the extension issues we've seen with an actual caught error (as opposed to something more subtle, like -1 in FMP) have been tracked down without the URL. We can add the optional prompt for it later if we find ourselves asking for it more often than not
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.
🐛➡️📜 looks great. Thanks for this!
just came across this. Awesome work here @olingern! |
Thanks, @paulirish. You guys have an awesome initiative and it's a fun project to contribute to! |
* Includes error message, stack trace, chrome and lighthouse versions in issue body
fixes #919