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

Handle unexisting/deleted pages #82

Merged
merged 5 commits into from
Nov 15, 2015
Merged
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 4 additions & 1 deletion lib/bot.js
Original file line number Diff line number Diff line change
Expand Up @@ -372,13 +372,16 @@ module.exports = (function() {
return;
}

if(data === null)
callback(title+" does not exist", null);
Copy link
Owner

Choose a reason for hiding this comment

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

Please create an instance of Error and then pass it to the callback (nodejs convention).


Copy link
Owner

Choose a reason for hiding this comment

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

I guess we're missing return here.

var page = getFirstItem(data.pages);

callback(
null,
(page.categories || []).map(function(cat) {
// { ns: 14, title: 'Kategoria:XX wiek' }
return cat.title.substring(cat.title.indexOf(":")+1);
return cat.title;
})
);
});
Expand Down