$ ./guess_the_languageProblem Solving — fix the bug
Problem Solving — fix the bug · medium · #98

What is the correct fix?

fetchUser().then((u) => render(u));
  1. Add a .catch((e) => report(e)) handler
  2. Add a .finally((e) => report(e)) handler
  3. Wrap the call in a try/catch block
  4. Change .then into an await call
Without catch a rejection becomes an unhandled promise rejection.
Play Problem Solving ▸