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

feature-request: add reason to runtime error output #5838

Closed
samfoot opened this issue Aug 15, 2018 · 5 comments
Closed

feature-request: add reason to runtime error output #5838

samfoot opened this issue Aug 15, 2018 · 5 comments

Comments

@samfoot
Copy link

samfoot commented Aug 15, 2018

Feature request summary

When a FAILED_DOCUMENT_REQUEST error occurs the error message does not give the actual reason for this as it's not part of the stack trace for example:

Runtime error encountered: Your page failed to load. Verify that the URL is valid and re-run Lighthouse. LHError: FAILED_DOCUMENT_REQUEST at Function.getPageLoadError (/lighthouse/lighthouse-core/gather/gather-runner.js:168:21) at Function.afterPass (/lighthouse/lighthouse-core/gather/gather-runner.js:273:38) at process._tickCallback (internal/process/next_tick.js:68:7)

I am proposing to add the actual reason be displayed (if available) from the error, for example:

Runtime error encountered: Your page failed to load. Verify that the URL is valid and re-run Lighthouse. Reason: net::ERR_CERT_COMMON_NAME_INVALID LHError: FAILED_DOCUMENT_REQUEST at Function.getPageLoadError (/lighthouse/lighthouse-core/gather/gather-runner.js:168:21) at Function.afterPass (/lighthouse/lighthouse-core/gather/gather-runner.js:273:38) at process._tickCallback (internal/process/next_tick.js:68:7)

I am willing to do the work to add this.

What is the motivation or use case for changing this?

Being able to determine what the actual error that caused the page to fail to load would better help me explain to my users why the audit failed.

How is this beneficial to Ligthhouse?

Better diagnostics for developers that use the CLI to programatically audit.

@devtools-bot

This comment has been minimized.

@paulirish
Copy link
Member

@samfoot yeah this sounds great. Happy for you to take this.

@paulirish paulirish reopened this Aug 15, 2018
@paulirish
Copy link
Member

@patrickhulce do you remember why we moved the errorReason from the Error's message into a property?

@samfoot At the very least showRuntimeError in the CLI could also log error.reason. But I also think it's reasonable to change the message based on the errorReason. Let's see what patrick sez..

@patrickhulce
Copy link
Collaborator

Oh yeah that was mostly for Sentry coalescing on the error message. In most of the cases we did this I think it was a win to not give so much debugging info to users who are confused, but in this case I agree it is a bit of a loss. I think it'd make sense to show the real reason here too 👍

Maybe we could do a transform of errors before sending them into the LHR? i.e. if the error has a .reason property then make it the message and stick the message into parens or something?

@brendankenny
Copy link
Member

fixed in #6083, though the code currently doing this (using localization replacement) superseded that in #6457

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants