I was testing the field, and if you put a filter so there are no resulting countries (like "xas" of something else) it's showing a 404 error in the request and shows nothing in the list, maybe you can improve it by catching the error in the service?, something like this:
getByName(countryName:string):Observable<string[]>{returnthis.http.get<Country[]>(`https://restcountries.eu/rest/v2/name/${countryName}`).pipe(map(countryList=>countryList.map(({name})=>name)),catchError((err)=>{if(err.error.status===404){returnof([`--- No results for: ${countryName} ---`]);}}));}
I am passionate about programming, expanding my abilities, and sharing knowledge. I try to be up to date with the latest versions of technology and I am happy to learn new, unknown solutions.
I was testing the field, and if you put a filter so there are no resulting countries (like "xas" of something else) it's showing a 404 error in the request and shows nothing in the list, maybe you can improve it by catching the error in the service?, something like this:
The result would be like this:
Good point. I didn't focus on error handling, but definitely on production; it should be.