DEV Community

Discussion on: Polling using RxJS

Collapse
 
qm3ster profile image
Mihail Malo • Edited

(in the first, programmatic code example) But what if you get back an object saying {errors: ['lololo']}? You'd be in right trouble then, with your if (responseObject.processing)!

Collapse
 
hoverbaum profile image
Hendrik

Valid point!

You should always deal with errors scenarios. In this case however I decided to focus on the points essential for the post.

Here an error object coming back from the server would trigger pollingFinishedFor and in there we could handle an error. It's probably even wanted behavior to stop polling should we get a processing error back from the server. Maybe pollingFinishedFor would get the item from teh backend again and then do something based on the return value.