Http get request handle

Hi all,
I have facing one issue regarding the API. I will get details of media file in database then with that details i ll get id for the media file with that id I’ll get a media file from s3. And that path is directly given in html. In that case if the media file is not there the media ll not load there.
I want to handle error for that HTTP get request so that if the media file is not there i can load a new screen to give a better user experience.
My doubt is whether i can handle it in the normal way of error handling method or there is any other better solution for this.

Can anyone help me out, Thanks.


<img [src]=“getContentURL(” id=“imag{{}}” class=“image” alt="">

contentID is media file id.
this.contentURL will have the http link

getContentURL(contentID: string) {
return this.contentURL + contentID;

Calling functions in [box] binding expressions is virtually always a bad idea for performance reasons, because change detection calls them zillions of times. The one you have is very lightweight, so you probably won’t notice much in this particular instance, but it’s a trap that should be avoided whenever possible (and it is here, by just precomputing the URL and stashsing it as a property of Profilecontents (which needs a new name BTW, because Initial Capital Letters are for classes, not properties)).

Hi @rapropos,
Thank you for your valuable suggestion. Actually I’m unaware to handle error for that http request can you please help me, Thanks.