Skip to content

get more information about failed connect() to the caller #113

Closed
@vladak

Description

@vladak

When connect() fails due to repeated failures, it throws RuntimeError:

try:
sock.connect((connect_host, port))
except MemoryError:
sock.close()
sock = None
except OSError:
sock.close()
sock = None
if sock is None:
raise RuntimeError("Repeated socket failures")

This is not very useful for the caller. Some suggestions:

  • rethrow the last exception
  • wrap the exceptions raised by connect() into RuntimeError exception (or maybe used dedicated exception)
  • add some info about the problem to the RuntimeError text (including how many times it tried)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions