Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialdylancascio
11,400 PointsPromise is returned with incomplete data
Hi, I just came across this problem when working on the "How many people are in space" video and thought it might help to share the workaround I came up with.
The Promise from getProfiles
is being correctly returned, however one of the astronauts has a common name at this current time. Wikipedia returns a "disambiguation"
page instead of a "standard"
page. This means that in generateHTML
when the template literal is being constructed for the <img>
element, person.thumbnail
is undefined
.
Edit: to clarify, this means that the JSON is properly returned, but execution is halted during HTML generation and the elements are not displayed.
1 Answer
Zimri Leijen
11,835 PointsYeah, I had that same problem. You can either ignore it, or make a workaround to catch that issue.
There are a couple of astronauts with ambiguous names.
dylancascio
11,400 Pointsdylancascio
11,400 PointsAs a workaround, I created a new function to check for a disambiguous entry to handle this particular case and add in a
thumbnail.source
property to allow execution to continue. Finally, I used.then()
after getting the JSON for each person and passed the person object to the new disambiguous checker: