def write(self, data):
"""Write data to the file.
:param data: data to be written
:raises: VimConnectionException, VimException
"""
try:
self._file_handle.send(data)
except requests.RequestException as excep:
excep_msg = _("Connection error occurred while writing data to"
" %s.") % self._url
LOG.exception(excep_msg)
raise exceptions.VimConnectionException(excep_msg, excep)
except Exception as excep:
# TODO(vbala) We need to catch and raise specific exceptions
# related to connection problems, invalid request and invalid
# arguments.
excep_msg = _("Error occurred while writing data to"
" %s.") % self._url
LOG.exception(excep_msg)
raise exceptions.VimException(excep_msg, excep)
评论列表
文章目录