Understanding error handling in Promise chains