Skip to content

exception should be raised for badly-formed calls #300

Closed

Description

@guruofgentoo

With the recent change to email validator signature, this previously-correct usage now fails:

domain_whitelist = ['microsoft.com']
email('bill.gates@microsoft.com', domain_whitelist)
ValidationFailure(func=email, args={'reason': 'email() takes 1 positional argument but 2 were given', 'value': 'bill.gates@microsoft.com'})

But that's not a validation issue - it's a programming issue, and one that becomes difficult to track down when the form validation library is checking True/False and reporting an invalid email address.

When the error is not because of the input being validated, but rather due to the way the validator is called, we need to have exceptions raised.

Activity

  1. nandgator commented on Sep 20, 2023

    @nandgator
    Collaborator

    Note to self: related #139

  2. guruofgentoo commented on Sep 20, 2023

    @guruofgentoo
    Author

    Just to push back on the duplicate tag a little bit: I don't envision ValidationFailure being raised here (which seems to be what #139 argues for), because it's not a validation exception. I would expect the underlying exception to be raised, rather than being trapped and returned differently.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementIssue/PR: A new featureoutdatedIssue/PR: Open for more than 3 months

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions