Q:

how to pass parameter in angular catch block

Wanted to see if this was possible and if so how. On Angular's .catch block, I want to have my handleError callback and pass an id. but regardless the function gets called, I know it because of how the promise is formed. but I was hoping there was a way to still pass in a parameter without calling the function beforehand.
//controller
function handleError(id) {
  showErrorMessage(id);
}

callFactory
  .then(update)
  .catch(handleError)
  .finally(clearLoader);

// would like to use something like this.

callFactory
  .then(update)
  .catch(handleError(2)) //this gets called regardless
  .finally(clearLoader);

A:

The first argument of the .catch is always going to be the exception that was thrown. You could probably achieve what you're looking for with a  closure method. Something like:
function handleError(id) {
  return function(err) {
    // access to both err and id
}

Altertnatively, you could throw the id in the .catch, then it would be picked up by the next catch
.catch(err=> { throw id })
.catch(id=> ... )

