Skip to content
This repository has been archived by the owner on Mar 18, 2023. It is now read-only.

Commit

Permalink
Stop gap for issue #44. Setup rudimentary logging for better debugging.
Browse files Browse the repository at this point in the history
  • Loading branch information
kusold committed Nov 2, 2016
1 parent 672a75c commit b009358
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions habitSync.js
Original file line number Diff line number Diff line change
Expand Up @@ -215,8 +215,11 @@ habitSync.prototype.syncItemsToHabitRpg = function(items, cb) {
habitrpg: res.body
};
// Adds date to habitrpg record if type is daily
if(res.body.type == "daily") {
if(res.body && res.body.type == "daily") {
history.tasks[item.todoist.id].habitrpg.date = new Date(item.todoist.due_date_utc);
} else if (!res.body) {
// TODO: Remove this once GH issue #44 actually gets fixed.
console.error('ERROR: Body is undefined. Please file an issue with this. res:' + JSON.stringify(res))
}
cb();
}
Expand All @@ -234,8 +237,8 @@ habitSync.prototype.getHabitAttributeIds = function(callback) {
var labels = {};

request.post('https://api.todoist.com/API/getLabels')
.send('token=' + self.todoist)
.end(function(err, res) {
.send('token=' + self.todoist)
.end(function(err, res) {
var labelObject = res.body;
for(var l in labelObject) {
labels[l] = labelObject[l].id;
Expand Down

0 comments on commit b009358

Please sign in to comment.