Enhance error callbacks

Send the request data buffer and the connection object to the error callbacks, so we can log more information about the request instead of silently failing.