Created
November 25, 2015 11:02
-
-
Save jpina/c41248a81b9c0e8e935a to your computer and use it in GitHub Desktop.
06 Error Handling
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
get('story.json').then(function(response) { | |
console.log("Success!", response); | |
}, function(error) { | |
console.log("Failed!", error); | |
}); | |
/************************************************/ | |
get('story.json').then(function(response) { | |
console.log("Success!", response); | |
}).then(undefined, function(error) { | |
console.log("Failed!", error); | |
}); | |
/************************************************/ | |
asyncThing1().then(function() { | |
return asyncThing2(); | |
}).then(function() { | |
return asyncThing3(); | |
}).catch(function(err) { | |
return asyncRecovery1(); | |
}).then(function() { | |
return asyncThing4(); | |
}, function(err) { | |
return asyncRecovery2(); | |
}).catch(function(err) { | |
console.log("Don't worry about it"); | |
}).then(function() { | |
console.log("All done!"); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment