Custom Observable events RxJS


Does anyone know a way to customize an observable.

I would like to do a http.get and send my data into an observable
In case there’s an error then retry but trigger a custom event on my observable so that i can notify the user it will retry. Obs.custom()
And after 5 times trigger Obs.error(err) and stop

Events would solve my issue but i dont want it system wide.

Observable side;

Consuming side

(x)=>{ Handle my data },
(y)=>{ console.log('custom stuff');},
(error=>{ handle error} 



Since I have to call a not-so-well-designed API, I have the observable (or promise in my case) return a custom object, containing a status code, the data and message in case of error. This way I can transform HTTP status codes and API error codes into a consistent object to process. Hope this will help you.{
    code: 200, // success
    data: mydate,
    code: 500, // error
    message: 'Internal server error'