Yury Selivanov added the comment:

> Case (c) sidesteps the above questions.

I like the (c) option. I don't think we should use logging/warnings here, as 
they can produce unwanted noise that few know how to silence.

When the list of errors is passed as a second argument to the exception, how is 
it rendered?  Would it make sense to concatenate all error messages:


  if errs:
      errors_msg = '  \n'.join(str(e) for e in errs)
      raise error(f"connection failed:\n{errors_msg}", errs)

Or maybe we should track which addr caused which exception?

  for res in getaddrinfo(host, port, 0, SOCK_STREAM):
      af, socktype, proto, canonname, sa = res
      try:
          ...
      except error as e:
          errs.append((canonname, e))
          ...

  if errs:
      error_msg = '  \n'.join(f'{addr}: {e}' for addr, e in errs)
      raise error('connection failed:\n{error_msg}', errs)

----------
nosy: +yselivanov

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue29757>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to