Skip to content

Instantly share code, notes, and snippets.

@mii9000
Created March 24, 2016 14:52
Show Gist options
  • Save mii9000/0f7308340e77a1a03393 to your computer and use it in GitHub Desktop.
Save mii9000/0f7308340e77a1a03393 to your computer and use it in GitHub Desktop.
Common error handler for same type of Promise returning functions
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