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 trialAlejandro Bryan
10,923 PointsI'm having a lot of problems with the Promises call.
hi guys! I'm having a lot of problems with promise call, even if I write the same code as the teacher, it seems to be a broken link, I feel me somehow like a stupid person. maybe I'm gut enough to learn how to program.
5 Answers
Steven Parker
231,268 PointsThis one's not your fault. This issue is due to two 3rd-party API's having a disagreement about spelling. An improvement would be to display the original name with a message indicating that the profile wasn't found. Code that could automatically resolve this kind of thing in a generic way would be rather complex.
But if you don't mind applying a temporary (and potentially brittle) fix for these specific cases, you could just translate the names as you look up the profiles:
function getProfiles(json) {
const profiles = json.people.map( person =>
getJSON(wikiUrl + person.name.replace("Anatoly", "Anatoli")
.replace("Chris", "Christopher"))
);
return Promise.all(profiles);
}
Alejandro Bryan
10,923 PointsAlejandro Bryan
10,923 PointsI appreciated your help. thanks a lot
Murilo de Melo
14,456 PointsHi Alejandro, tnx for your question. I'm getting the same problem. And tnx Steven too for the help :) That's very bad considering that a huge desaster because of such a mere issue of spelling.
Mike Campbell
19,847 PointsActually, that solution looks pretty good. It only works if you know it's misspelled though. I scratched my head for a while when I was trying to figure it out.
Steven Parker
231,268 PointsSteven Parker
231,268 PointsIt might be something as simple as a little typo. Show your code and we can take a look. Even better, make a snapshot of your workspace and post the link to it here.