(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)!
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.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
(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 yourif (responseObject.processing)
!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. MaybepollingFinishedFor
would get the item from teh backend again and then do something based on the return value.