Created
March 24, 2016 14:52
-
-
Save mii9000/0f7308340e77a1a03393 to your computer and use it in GitHub Desktop.
Common error handler for same type of Promise returning functions
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
aFunctionThatReturnPromise({ shiftid: event.shiftId, status: 'approve' }) | |
.done(function () { | |
//Do somehting when the promise succeeds | |
}) | |
.fail(failHandler); | |
//Common function for fail handling | |
function failHandler(msg, res){ | |
alert(msg); | |
console.log(res); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment