Also support passing through state param for failure callback

Hi

Sorry, I probably should have thought about this more when doing the other change but I was so focussed on the success callback I failed to consider that I would also like to return the application state for the error callback too.

Thanks
Shane