Move error handling for taskSubmitter
taskSubmitter ended up in a confused state if the initial POST request
encountered an error.
I've updated startPolling
to return a Promise, and moved the
error handling code to the top level.
This doesn't change anything for the case where we get a non-error response to the POST request, but means that e.g. 400 errors get caught and displayed properly.