Skip to content

Instantly share code, notes, and snippets.

@zlatkov
Created October 11, 2017 14:46
Show Gist options
  • Save zlatkov/c5fc0706d2d37ce3bb9db75e8a991807 to your computer and use it in GitHub Desktop.
Save zlatkov/c5fc0706d2d37ce3bb9db75e8a991807 to your computer and use it in GitHub Desktop.
function loadData() {
try { // Catches synchronous errors.
getJSON().then(function(response) {
var parsed = JSON.parse(response);
console.log(parsed);
}).catch(function(e) { // Catches asynchronous errors
console.log(e);
});
} catch(e) {
console.log(e);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment