add fetch state error handling (bug 1015266)

* Gives fetch some error handling plus a retry on timeouts.
* Updates tests so that more or less the same signature e.g. an object is used across the board.