Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Validation error messages refer to the super classes #696

Closed
maximlt opened this issue Mar 7, 2023 · 1 comment
Closed

Validation error messages refer to the super classes #696

maximlt opened this issue Mar 7, 2023 · 1 comment
Labels
good first issue Guidance available, not on critical path, help welcome :) type-bug Bug report

Comments

@maximlt
Copy link
Member

maximlt commented Mar 7, 2023

Validation code in a Parameter often calls the Parameter's parents validation methods. The Parameter name is hard-coded in the validation error message, which means that users may receive an error message that is a bit confusing as it doesn't mention the type of the invalid Parameter but the type of one of its parents.

This snippet emits ValueError: Tuple parameter 'r' only takes a tuple value, not <class 'str'>. while the Parameter is a Range. Range is indeed a subclass of Tuple.

import param

class P(param.Parameterized):
    r = param.Range()

P(r='test')

Substituting the hard-coded Parameter name with self.__class__.__name__ would probably fix that.

@maximlt maximlt added type-bug Bug report good first issue Guidance available, not on critical path, help welcome :) labels Mar 7, 2023
@maximlt maximlt added this to the v2.x milestone Apr 5, 2023
@maximlt
Copy link
Member Author

maximlt commented Nov 28, 2023

Actually fixed in #808 🎉

@maximlt maximlt closed this as completed Nov 28, 2023
@philippjfr philippjfr removed this from the v2.x milestone Mar 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Guidance available, not on critical path, help welcome :) type-bug Bug report
Projects
None yet
Development

No branches or pull requests

2 participants