More structured write error

On 40X write errors from the server, log more info, and in a more structured way.