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 404 error message for "grunt generate-phet-io-api-files" #928

Closed
pixelzoom opened this issue Apr 3, 2020 · 6 comments
Closed

improve 404 error message for "grunt generate-phet-io-api-files" #928

pixelzoom opened this issue Apr 3, 2020 · 6 comments

Comments

@pixelzoom
Copy link
Contributor

If a "404 (Not Found)" error occurs during API harvest, ?phetioPrintPhetioFiles provides a nice console error message with plenty of detail to immediately determine the problem:

GET http://localhost/~cmalley/GitHub/hookes-law/js/systems/view/ParallelSeriesRadioButtonGroup.js net::ERR_ABORTED 404 (Not Found)

With grunt generate-phet-io-api-files, you get a vague 404 error with no details:

% grunt generate-phet-io-api-files
Running "generate-phet-io-api-files" task
Failed to load resource: the server responded with a status of 404 (Not Found)

The same error info is presumably available to grunt, so I'll create an issue to "enhance" the error message. Please add error details to grunt generate-phet-io-api-files.

@chrisklus
Copy link
Contributor

According to the puppeteer docs, the additional info being requested comes from consoleMessage.location(), see https://pptr.dev/#?product=Puppeteer&version=v2.1.1&show=api-consolemessagelocation

Right now, the error message we're seeing only comes from consoleMessage.text(). The grunt task appears to check for consoleMessage.location() and print that too if it exists, but it's undefined on my machine (and likely everyone else's). I think this is because our version of puppeteer is too old to support consoleMessage.location().

When I run npm list -g puppeteer in a sim repo, it returns [email protected]. The docs say that consoleMessage.location() has been supported since v1.12.0. I tried out updating the version in perennial's package.json from 1.11.0 to 2.1.1 (latest) + npm prune && npm install. I'm not going to commit this yet but will open another issue in perennial to make sure this change is okay to do.

When running the latest version on my machine, consoleMessage.location() now returns an object that includes the url of the file that was not found. Here's what a similar error to @pixelzoom's looks like when running grunt generate-phet-io-api-files:

chk@voyager:~/phetsims/energy-forms-and-changes$ grunt generate-phet-io-api-files
Running "generate-phet-io-api-files" task
Error from sim: Failed to load resource: the server responded with a status of 404 (Not Found):
  http://localhost:8080/dot/js/Vector7.js

@chrisklus
Copy link
Contributor

location.lineNumber is still returning undefined so this still isn't quite as helpful as the browser error, but i'm not sure what to do about that. Hopefully this is a lot better than before.

@pixelzoom
Copy link
Contributor Author

I think we can live without location.lineNumber. Knowing what resource failed to load is the important thing.

@chrisklus
Copy link
Contributor

Sounds good. Marking status:blocked until phetsims/perennial#170 is complete.

@chrisklus
Copy link
Contributor

@zepumph and @samreid corrected me in phetsims/perennial#170 - the grunt task relies on chipper's puppeteer, not perennial's. npm prune && npm install in chipper fixes the problem for me, does it for you as well @pixelzoom?

@pixelzoom
Copy link
Contributor Author

This looks great. Thanks @chrisklus. Closing.

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

4 participants