Skip to content

Improve error handling #67

@tdunning

Description

@tdunning

I suggest that the error handling in the URL parsing for connections needs improvement.

The improvements that I think are important include:

  • the default value for port should match the default value used by the DAG
  • the existence of the trust store file should be tested and a specific error message raised if it isn't found and readable
  • the pattern of the connection string should be tested more stringently with a detailed regex and by testing the contents of the option_dict to verify that required fields are present.
  • if the connection fails, the library should check to see if connections are being refused by attempting a simple connection to the host and port. If that fails, then the error can be reported as "No server at that address". If that succeeds, it can be reported as "SSL handshake with ${host} failed"
  • invalid values of the ssl flag should not be accepted. Consider using bool(distutils.util.strtobool(options_dict.get('ssl', ['true'])[0])) instead of a simply comparison.
  • the split on line 104 should be eliminated and the value of urllib.parse.urlparse(connection_str) should be put into a temp value so that the netloc can be extracted as the URL

I can make a pull request for this shortly.

def __parse_connection_url(connection_str):

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