-
-
Save kriskowal/1444114 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| var q = require('q'); | |
| var a = q.defer(); | |
| var b = q.defer(); | |
| q.when(a, function() { | |
| console.log('calling b'); | |
| return q.when(b, function() { | |
| console.log('throwing'); | |
| throw new Error('Hello World'); | |
| }, function (error) { | |
| console.log('handling error for b, rethrowing'); | |
| throw error; | |
| }); | |
| }, function() { | |
| console.log('handling error for a'); | |
| }) | |
| .fail(function () { | |
| console.log('handling error for anything above'); | |
| }); | |
| b.resolve('hi'); | |
| a.resolve('yo'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment