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

fix(gatsby-source-wordpress): check response exists before accessing its properties #11349

Merged
merged 1 commit into from
Jan 28, 2019
Merged

fix(gatsby-source-wordpress): check response exists before accessing its properties #11349

merged 1 commit into from
Jan 28, 2019

Conversation

henrycatalinismith
Copy link
Contributor

Description

This fixes a small bug in the error handler in gatsby-source-wordpress. The error handler actually introduces errors of its own at the moment by accessing response.request.path before it's confirmed there's a response object to rummage around in. I've fixed it by moving the offending console.log() down a line so that it happens after the if (!response) check immediately below.

Here's an example of how it looks when this happens:

error Plugin gatsby-source-wordpress returned an error


  TypeError: Cannot read property 'request' of undefined

  - http-exception-handler.js:14 httpExceptionHandler
    [abc]/[gatsby-source-wordpress]/http-exception-handler.js:14:49

Related Issues

Doesn't look like anyone's reported this yet 😅

@henrycatalinismith
Copy link
Contributor Author

henrycatalinismith commented Jan 28, 2019

The unit_tests_windows job failed with what appears to be a linter error in a type of file I haven't edited in this PR so I'm a bit confused about that!

2019-01-28T11:49:54.8104045Z yarn run v1.13.0
2019-01-28T11:49:54.8872695Z $ npm-run-all -s lint jest
2019-01-28T11:49:55.5970381Z $ npm-run-all --continue-on-error -p lint:code lint:other
2019-01-28T11:49:56.3433168Z $ npm run prettier -- --list-different
2019-01-28T11:49:56.3433965Z $ eslint --ignore-path .gitignore --ignore-path .prettierignore --ext .js,.jsx .
2019-01-28T11:49:57.3072108Z 
2019-01-28T11:49:57.3072399Z > @ prettier D:\a\1\s
2019-01-28T11:49:57.3072454Z > prettier "**/*.{md,css,scss,yaml,yml}" "--list-different"
2019-01-28T11:49:57.3072520Z 
2019-01-28T11:50:26.1552829Z docs\docs\tailwind-css.md
2019-01-28T11:50:55.0589099Z npm ERR! code ELIFECYCLE
2019-01-28T11:50:55.0775176Z npm ERR! errno 1
2019-01-28T11:50:55.0776113Z npm ERR! @ prettier: `prettier "**/*.{md,css,scss,yaml,yml}" "--list-different"`
2019-01-28T11:50:55.0797709Z npm ERR! Exit status 1
2019-01-28T11:50:55.0798122Z npm ERR! 
2019-01-28T11:50:55.0798495Z npm ERR! Failed at the @ prettier script.
2019-01-28T11:50:55.0798917Z npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

Any ideas?

Edit: oh I see lol it's doing this on every PR 😆

@pieh
Copy link
Contributor

pieh commented Jan 28, 2019

@hensmith yeah, sorry about that - we've merged PR with failing linting and now all PRs branched after this is having this problem

Copy link
Contributor

@pieh pieh left a comment

Choose a reason for hiding this comment

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

🙏 Thanks @hensmith!

@pieh pieh merged commit 3beb891 into gatsbyjs:master Jan 28, 2019
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.

None yet

2 participants