Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Revert Maybe Change from 0.12.1 #439

Closed
Tankanow opened this issue Dec 7, 2020 · 0 comments
Closed

Revert Maybe Change from 0.12.1 #439

Tankanow opened this issue Dec 7, 2020 · 0 comments

Comments

@Tankanow
Copy link
Contributor

Tankanow commented Dec 7, 2020

Revert Breaking Maybe change in 0.12.1

It seems like the Maybe change to propagate error information (#411) was not intended to be a breaking change. Unfortunately, this is a breaking change because many consumers rely on Any's short-circuiting behavior. That is, the following code now does not do the same thing anymore:

def validator_that_raises_typeerror(x):
    if x is None:
        raise TypeError('Ooops')
    return x

s = Maybe(validator_that_raises_typeerror)

# pre 0.12.1
s(None)  # => returns None

# post 0.12.1
s(None)  # => throws TypeError

You can argue that the validator above is malformed, and you may be right; however, it doesn't change the fact that voluptuous currently allows that validator and the Maybe change results in different behavior, not just more error information.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants