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

Cannot read property 'result' of undefined #44

Closed
Fannon opened this issue Jan 23, 2015 · 2 comments
Closed

Cannot read property 'result' of undefined #44

Fannon opened this issue Jan 23, 2015 · 2 comments
Assignees
Labels

Comments

@Fannon
Copy link
Contributor

Fannon commented Jan 23, 2015

This happens if mediawiki crashes (PHP error) to nodemw:

Maybe this is something you should check and return as an err callback instead.
Thanks for introducing this, btw!

TypeError: Cannot read property 'result' of undefined
at [...]\node_modules\nodemw\lib\bot.js:299:22
@Fannon
Copy link
Contributor Author

Fannon commented Jan 23, 2015

So instead of

if (!err && data.result && data.result === "Success")

Using this should fix it:

if (!err && data && data.result && data.result === "Success") {

@macbre macbre added the bug label Jan 23, 2015
@macbre macbre self-assigned this Jan 23, 2015
@macbre macbre closed this as completed in ae45a63 Jan 24, 2015
@macbre
Copy link
Owner

macbre commented Jan 24, 2015

Fixed the root cause in api.js.

Thanks for the report. Pushed nodemw@0.4.1 to npm.

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

No branches or pull requests

2 participants