Skip to content

Use exceptions to fail clearly, loudly, properly #3

@aaaaalbert

Description

@aaaaalbert

There is a potential issue in cdmconfighandler.py where an unknown resource type during config parsing leads to an error message in the log, but the function call still finishes and returns. (That it implicitly returns None instead of the expected list then will likely generate an opaque error somewhere further down the call chain.)

Consider instead to use custom Exception subclasses for situations like these. Even if you just fail with an unhandled exception in, well, exceptional cases like these, you can at least use the exception message to communicate what the problem was.

Example:

    if rrType == "mx":
        # Handle MX records
    elif ...:
        ...
    else:
        raise UnsupportedRRTypeError("Unsupported RR type '" + str(rrType) + "'")

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions