reject promises when api return some error