From 6bbdb34da02a46f37f6fb1f8a17d14a057f1b768 Mon Sep 17 00:00:00 2001 From: Kristian Dupont Date: Tue, 3 Jan 2017 15:16:46 +0100 Subject: [PATCH] Catch analytics errors (#770) --- lib/submit-analytics.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/submit-analytics.js b/lib/submit-analytics.js index 02f3cede..00fc489c 100644 --- a/lib/submit-analytics.js +++ b/lib/submit-analytics.js @@ -44,7 +44,7 @@ function getDarwinIdentifier() { } const mac = iface[0].mac.replace(/:/g, ''); - return Buffer.from(mac, 'hex'); + return new Buffer(mac, 'hex'); } function getLinuxIdentifier() { @@ -89,7 +89,8 @@ module.exports = function(eventName) { } }; - request(`https://api.mixpanel.com/track/?data=${Buffer.from(JSON.stringify(payload), 'utf8').toString('base64')}&ip=1`); + request(`https://api.mixpanel.com/track/?data=${Buffer.from(JSON.stringify(payload), 'utf8').toString('base64')}&ip=1`, + () => { /* Analytics failed. Do nothing. */ }); } if (require.main === module) {