Last active
September 20, 2017 20:12
-
-
Save ccnixon/13fb7816151e533bf365c0ba431e67f6 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
async function track (msg) { | |
return Promise.resolve(foo) // intentially triggering ReferenceError for undefined `foo` | |
} | |
function process (msg, done) { | |
try { | |
track(msg).then(res => done(null, reqs)).catch(err => done(err, reqs)) | |
} catch (e) { | |
err.code = 'INTERNAL' | |
err.retry = true | |
return done(err) | |
} | |
} | |
function onMessage (msg) { | |
process(msg, (err, res) => { | |
// log err/res to datadog or whatever... | |
if (err) { | |
console.log(err.code) // undefined | |
stats.err(err) | |
} else { | |
stats.success(res) | |
} | |
}) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment