More structured write error

On 40X write errors from the server, log more info, and in a more structured way.
For integrating with error tracking services like Raygun.
This is that log I was talking about.