Skip to content
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

Merged
merged 4 commits into from
Nov 22, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion lighthouse-extension/app/src/popup.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand All @@ -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=Lighthouse Extension Error');
let titleError = err.message;
if (titleError.length > MAX_ISSUE_ERROR_LENGTH) {
titleError = `${titleError.substring(0, MAX_ISSUE_ERROR_LENGTH - 3)}...`;
}
const title = encodeURI('title=Extension Error: ' + titleError);
const body = '&body=' + encodeURI(qsBody);
Copy link
Member

Choose a reason for hiding this comment

The 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 err.message gets a little long.

Copy link
Contributor Author

@olingern olingern Nov 21, 2016

Choose a reason for hiding this comment

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

Mocking this up in Chrome, Github seems to new line around 77 characters (at my res) per line (60 characters of this error message).

Are two lines okay, or is one line preferable?
screen shot 2016-11-21 at 11 57 00 am

Copy link
Contributor

Choose a reason for hiding this comment

The 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.

Copy link
Contributor Author

@olingern olingern Nov 21, 2016

Choose a reason for hiding this comment

The 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;
Expand Down