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

core(gather): define new DNS failure LH Error #6579

Merged
merged 7 commits into from
Nov 16, 2018
Merged

core(gather): define new DNS failure LH Error #6579

merged 7 commits into from
Nov 16, 2018

Conversation

paulirish
Copy link
Member

Seeing a lot of these errors. I think we want to expose them to the user individually.

Copy link
Collaborator

@patrickhulce patrickhulce left a comment

Choose a reason for hiding this comment

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

nothing functional about this other than we're explaining what ERR_NAME_NOT_RESOLVED means to the user now, right?

@@ -182,6 +182,13 @@ const ERRORS = {
lhrRuntimeError: true,
},

// Protocol timeout failures
DNS_FAILURE: {
Copy link
Collaborator

Choose a reason for hiding this comment

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

proto update :)

Copy link
Member

@exterkamp exterkamp left a comment

Choose a reason for hiding this comment

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

LGTM excited to get more visibility on this. Need proto change to add new LH Error. May need future PR to test this code also in gather-runner-test.

@paulirish
Copy link
Member Author

ptal

Copy link
Member

@brendankenny brendankenny left a comment

Choose a reason for hiding this comment

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

LGTM with nits

@@ -49,6 +49,8 @@ enum LighthouseError {
PROTOCOL_TIMEOUT = 17;
// Used when the page is not responding after maxWaitForLoad.
PAGE_HUNG = 18;
// DNS timed out for the main document request.
Copy link
Member

Choose a reason for hiding this comment

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

handles more cases than just a timeout?

// https://cs.chromium.org/chromium/src/net/base/net_error_list.h?rcl=cd62979b
if (
netErr.startsWith('net::ERR_NAME_NOT_RESOLVED') ||
netErr.startsWith('net::ERR_NAME_RESOLUTION_FAILED') ||
Copy link
Member

Choose a reason for hiding this comment

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

just test equality for these two? Or are these expected as prefixes?

netErr.startsWith('net::ERR_DNS_')
) {
errorDef = {...LHError.errors.DNS_FAILURE};
} else {
Copy link
Member

Choose a reason for hiding this comment

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

these conditionals are multiplying in an unseemly fashion. Maybe #6457 can take on cleaning them up with early returns @exterkamp

netErr.startsWith('net::ERR_NAME_RESOLUTION_FAILED') ||
netErr.startsWith('net::ERR_DNS_')
) {
errorDef = {...LHError.errors.DNS_FAILURE};
Copy link
Member

Choose a reason for hiding this comment

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

if no string/message altering, no need to object spread to get a copy (e.g. see NO_DOCUMENT_REQUEST above)

@paulirish
Copy link
Member Author

@patrickhulce @exterkamp sg?

// Wrap gatherer response in promise, whether rejected or not.
Promise.resolve().then(_ => gatherer.afterPass(passContext, passData));
const artifactPromise = pageLoadError
? Promise.reject(pageLoadError)
Copy link
Member

Choose a reason for hiding this comment

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

did prettier get loose? This is bad (I'm surprised we don't lint it) and the concat thing above is definitely worse :)

Copy link
Member Author

Choose a reason for hiding this comment

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

prettier! get back in your cage.

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.

4 participants