Skip to content

Instantly share code, notes, and snippets.

@sahajamit
Forked from Gaafar/catch-async.js
Created August 18, 2017 02:30
Show Gist options
  • Save sahajamit/ab02ef1d9881fd6ffd1d5d5c5ba0d417 to your computer and use it in GitHub Desktop.
Save sahajamit/ab02ef1d9881fd6ffd1d5d5c5ba0d417 to your computer and use it in GitHub Desktop.
const makeRequest = async () => {
try {
// this parse may fail
const data = JSON.parse(await getJSON())
console.log(data)
} catch (err) {
console.log(err)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment