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 trialJason Pallone
11,340 PointsNo promise objects are being returned?
My code is exactly the same ( I confirmed this by literally copying and pasting from the project files final code ) but no promise objects are being returned. With the normal AJAX request it will display the astronauts as normal. But when using a promise, it gets rejected and returns nothing.
promises.js:20 GET https://en.wikipedia.org/api/rest_v1/page/summary/Hazzaa%20Ali%20Almansoori 404 Error at XMLHttpRequest.xhr.onload (promises.js:15)
is the exact error i'm getting. So it's saying 404 for this astronaut and I figure that is crashing the program? Any suggestions?
2 Answers
KRIS NIKOLAISEN
54,971 PointsFor testing purposes I just updated getProfiles
in promises.js
function getProfiles(json) {
const profiles = json.people.map( person => {
if (person.name == "Hazzaa Ali Almansoori") {
return getJSON("https://en.wikipedia.org/api/rest_v1/page/summary/Hazza_Al_Mansouri")
}
else {
return getJSON(wikiUrl + person.name);
}
});
return profiles;
}
and it was logged as resolved. But ideally this is something that would be updated at the site.
KRIS NIKOLAISEN
54,971 PointsThe name is currently spelled differently on wikipedia so would need to be updated. This link returns the page:
https://en.wikipedia.org/api/rest_v1/page/summary/Hazza_Al_Mansouri
Jason Pallone
11,340 PointsHow would I update that name specifically? Or is that something their site needs to update? Thank you for the response!
Jason Pallone
11,340 PointsJason Pallone
11,340 PointsPerfect! Thank you!