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: add top-level runtimeError #6014

Merged
merged 7 commits into from
Sep 18, 2018
Merged

core: add top-level runtimeError #6014

merged 7 commits into from
Sep 18, 2018

Conversation

brendankenny
Copy link
Member

@brendankenny brendankenny commented Sep 13, 2018

@paulirish

Here's one simple approach to #5881. All artifact errors are caught, and any deemed runtimeError worthy are floated to the top-level property in the LHR. From that bug, this handles

  1. tracing result failures: NO_tracing_start, no_navstart, NO_FCP, no_dcl = FATAL
  2. Screenshot/speedline errors = all fatal. (unless its a pain. no big deal, really)

It sort of handles

  1. defaultPass pageload error = runtimeError
    • 500'd. 400'd. certificate error. network disconnected / offline.
    • FAILED_DOCUMENT__REQUEST, NO_DOCUMENT__REQUEST

but if that pageload error affects enough audits (which it usually does) we throw from the whole Lighthouse run and don't ever return an LHR.

Like the idea mentioned in #5881 (comment), I'd prefer to continue throwing exceptions for these cases and then checking outside core in runLighthouseForLR that the thrown error has lhrRuntimeError set on it. Most of our clients just want a thrown error in those cases, not a pseudo-LHR, and dealing with a pseudo-LHR just makes tracking the LHR type and what's on it messier when we really just want an exception floated up.

So I don't think it's worth doing that inside core. In runLighthouseForLR we can create that pseudo-LHR with just the top-level runtimeError property.

Doing it that way will completely handle (1) above and

  1. tracing recording failures: TRACING_ALREADY_STARTED, PARSING_problem, read_failed, (timeout_during_trace_retreival)
    if you're still good with that idea.

If this is 👍 from you I can add that and tests.

@brendankenny
Copy link
Member Author

lol no

@devtools-bot

This comment has been minimized.

Copy link
Member

@paulirish paulirish left a comment

Choose a reason for hiding this comment

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

awesome. this matches what we need. :)

CI needs golden lhr update


return results.report;
return JSON.stringify(runtimeError, null, 2);
Copy link
Member

Choose a reason for hiding this comment

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

I was thinking we're returning a psuedo LHR so one more level on top of this:

return JSON.stringify({runtimeError}, null, 2);

Copy link
Member Author

@brendankenny brendankenny Sep 14, 2018

Choose a reason for hiding this comment

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

yeah I missed that.

@brendankenny brendankenny changed the title Proposal: core: add top-level runtimeError core: add top-level runtimeError Sep 14, 2018
@brendankenny
Copy link
Member Author

ok, ready for review @paulirish :)

Copy link
Member

@paulirish paulirish left a comment

Choose a reason for hiding this comment

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

looks so great. all lgtm except for one question on throwing in ext-bg

} catch (err) {
// If an error ruined the entire lighthouse run, attempt to return a meaningful error.
if (!(err instanceof LHError) || !err.lhrRuntimeError) {
throw err;
Copy link
Member

Choose a reason for hiding this comment

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

In this situation I think we should not throw but instead return an "UNKNOWN_ERROR" i guess.

tbh i dont know what throwing does in this context. my guess is its not caught and triggers a timeout?

Copy link
Member Author

Choose a reason for hiding this comment

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

tbh i dont know what throwing does in this context. my guess is its not caught and triggers a timeout?

well it would throw and be up to the caller to deal with, but we can do UNKNOWN_ERROR instead :)

Copy link
Member Author

Choose a reason for hiding this comment

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

done

Copy link
Member

@paulirish paulirish left a comment

Choose a reason for hiding this comment

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

so so good. \o/

🍳🍳🍳

@paulirish paulirish merged commit d031338 into master Sep 18, 2018
@paulirish paulirish deleted the runtimeerorr branch September 18, 2018 20:39
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.

3 participants