Throw TaskFailedException when the maximum number of failed attempts was reached