The answer is the rxjs operators retry/ retryWhen
Also, there are many ways to do some error handling. The simplest one, of course is to get the error and console log it in the http call (This can be done in the service or in whatever module you use). One example would be:
In the service:
public getWhatever() {
let url = `https://route_to_the_endpoint`;
return this.http.get(url, { headers: this.commonHeaders });
}
Un the component:
this.myservice
.getWhatever()
.subscribe(
(response: any) => {
/*Do whatever here*/
},
(error) => {
console.log(error);
/* Prepare some retry code here */
}
);
Error can also be processed in the service.
Other way to manage the error is to use rxjs pipes, for instance "catch/ catchError":
https://www.learnrxjs.io/learn-rxjs/operators/error_handling/catch
From what I see in your question, "retry"/ "retryWhen" to make sure the translation files reload when you get an error. The information for these pipes:
https://www.learnrxjs.io/learn-rxjs/operators/error_handling/retry
https://www.learnrxjs.io/learn-rxjs/operators/error_handling/retrywhen
You can use also rxjs "take(1)" in REST, as there is only one response.
Interceptors can be used to process error handling for all calls. But different calls may need different error handling.