diff --git a/agilecrm/agilecrm.js b/agilecrm/agilecrm.js index f8b3fde..b512697 100644 --- a/agilecrm/agilecrm.js +++ b/agilecrm/agilecrm.js @@ -176,7 +176,11 @@ ContactAPI.prototype.add = function add(contact, success, failure) { failure(e); } }); - }); + }).on("error", function(e){ + if (failure) { + failure(e); + } + }); try { var data = JSON.stringify(contact); @@ -219,7 +223,11 @@ ContactAPI.prototype.update = function update(contact, success, failure) { failure(e); } }); - }); + }).on("error", function(e){ + if (failure) { + failure(e); + } + }); try { var data = JSON.stringify(contact); @@ -258,7 +266,11 @@ ContactAPI.prototype.deleteContact = function deleteContact(contactId, success, failure(e); } }); - }); + }).on("error", function(e){ + if (failure) { + failure(e); + } + }); try { del.end(); @@ -295,7 +307,11 @@ ContactAPI.prototype.updateTagsById = function update(contact, success, failure) failure(e); } }); - }); + }).on("error", function(e){ + if (failure) { + failure(e); + } + }); try { var data = JSON.stringify(contact); @@ -334,7 +350,11 @@ ContactAPI.prototype.deleteTagsById = function update(contact, success, failure) failure(e); } }); - }); + }).on("error", function(e){ + if (failure) { + failure(e); + } + }); try { var data = JSON.stringify(contact); @@ -373,7 +393,11 @@ ContactAPI.prototype.createDeal = function createDeal(opportunity, success, fail failure(e); } }); - }); + }).on("error", function(e){ + if (failure) { + failure(e); + } + }); try { var data = JSON.stringify(opportunity); @@ -412,7 +436,11 @@ ContactAPI.prototype.updateDeal = function updateDeal(opportunity, success, fail failure(e); } }); - }); + }).on("error", function(e){ + if (failure) { + failure(e); + } + }); try { var data = JSON.stringify(opportunity); @@ -523,7 +551,11 @@ ContactAPI.prototype.deleteDealById = function deleteDealById(dealId, success, f failure(e); } }); - }); + }).on("error", function(e){ + if (failure) { + failure(e); + } + }); try { del.end(); @@ -560,7 +592,11 @@ ContactAPI.prototype.createNote = function createNote(note, success, failure) { failure(e); } }); - }); + }).on("error", function(e){ + if (failure) { + failure(e); + } + }); try { var data = JSON.stringify(note); @@ -599,7 +635,11 @@ ContactAPI.prototype.updateNote = function updateNote(note, success, failure) { failure(e); } }); - }); + }).on("error", function(e){ + if (failure) { + failure(e); + } + }); try { var data = JSON.stringify(note); @@ -673,7 +713,11 @@ ContactAPI.prototype.deleteNoteById = function deleteNoteById(contactId,noteId, failure(e); } }); - }); + }).on("error", function(e){ + if (failure) { + failure(e); + } + }); try { del.end(); @@ -710,7 +754,11 @@ ContactAPI.prototype.createTask = function createTask(task, success, failure) { failure(e); } }); - }); + }).on("error", function(e){ + if (failure) { + failure(e); + } + }); try { var data = JSON.stringify(task); @@ -748,7 +796,11 @@ ContactAPI.prototype.createTaskByEmail = function createTaskByEmail(email,task, failure(e); } }); - }); + }).on("error", function(e){ + if (failure) { + failure(e); + } + }); try { var data = JSON.stringify(task); @@ -786,7 +838,11 @@ ContactAPI.prototype.updateTask = function updateTask(task, success, failure) { failure(e); } }); - }); + }).on("error", function(e){ + if (failure) { + failure(e); + } + }); try { var data = JSON.stringify(task); @@ -859,7 +915,11 @@ ContactAPI.prototype.deleteTaskById = function deleteTaskById(taskId, success, f failure(e); } }); - }); + }).on("error", function(e){ + if (failure) { + failure(e); + } + }); try { del.end(); @@ -908,7 +968,11 @@ ContactAPI.prototype.changeContactOwner = function update(email, contactId, succ failure(e); } }); - }); + }).on("error", function(e){ + if (failure) { + failure(e); + } + }); try { put.write(post_data); @@ -990,7 +1054,11 @@ ContactAPI.prototype.getContactsByPropertyFilter = function getContactsByPropert failure(e); } }); - }); + }).on("error", function(e){ + if (failure) { + failure(e); + } + }); try { put.write(post_data); @@ -1038,7 +1106,11 @@ ContactAPI.prototype.getContactsByTagFilter = function getContactsByTagFilter(va failure(e); } }); - }); + }).on("error", function(e){ + if (failure) { + failure(e); + } + }); try { put.write(post_data); @@ -1113,7 +1185,11 @@ ContactAPI.prototype.createCustomField = function createCustomField(customJson, failure(e); } }); - }); + }).on("error", function(e){ + if (failure) { + failure(e); + } + }); try { var data = JSON.stringify(customJson); @@ -1156,7 +1232,11 @@ ContactAPI.prototype.updateCustomField = function updateCustomField(customJson, failure(e); } }); - }); + }).on("error", function(e){ + if (failure) { + failure(e); + } + }); try { var data = JSON.stringify(customJson); @@ -1199,7 +1279,11 @@ ContactAPI.prototype.createEvent = function createEvent(customJson, success, fai failure(e); } }); - }); + }).on("error", function(e){ + if (failure) { + failure(e); + } + }); try { var data = JSON.stringify(customJson); @@ -1249,7 +1333,11 @@ ContactAPI.prototype.addTagstoContacts = function addTagstoContacts(tags,contact failure(e); } }); - }); + }).on("error", function(e){ + if (failure) { + failure(e); + } + }); try { put.write(post_data); @@ -1298,7 +1386,11 @@ ContactAPI.prototype.deleteTagstoContacts = function deleteTagstoContacts(tags,c failure(e); } }); - }); + }).on("error", function(e){ + if (failure) { + failure(e); + } + }); try { put.write(post_data); @@ -1348,7 +1440,11 @@ ContactAPI.prototype.getCompaniesByPropertyFilter = function getCompaniesByPrope failure(e); } }); - }); + }).on("error", function(e){ + if (failure) { + failure(e); + } + }); try { put.write(post_data);