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

replace assertion errors and improve error messages #5898

Closed
wyli opened this issue Jan 25, 2023 · 2 comments
Closed

replace assertion errors and improve error messages #5898

wyli opened this issue Jan 25, 2023 · 2 comments

Comments

@wyli
Copy link
Contributor

wyli commented Jan 25, 2023

Is your feature request related to a problem? Please describe.
AssertionError such as this case:

if len(weights) != len(self.transforms):
raise AssertionError("transforms and weights should be same size if both specified as sequences.")

could be improved to have a more specific type, and the error messages can be more specific about the variables:

if len(weights) != len(self.transforms): 
    raise ValueError(
        f"transforms and weights should be same size, got {len(weights)} and {len(self.transforms)}."
    ) 
wyli added a commit that referenced this issue Feb 9, 2023
Signed-off-by: Wenqi Li <wenqil@nvidia.com>

part of #5898


### Types of changes
<!--- Put an `x` in all the boxes that apply, and remove the not
applicable items -->
- [x] Non-breaking change (fix or new feature that would not break
existing functionality).
- [ ] Breaking change (fix or new feature that would cause existing
functionality to change).
- [ ] New tests added to cover the changes.
- [ ] Integration tests passed locally by running `./runtests.sh -f -u
--net --coverage`.
- [ ] Quick tests passed locally by running `./runtests.sh --quick
--unittests --disttests`.
- [ ] In-line docstrings updated.
- [ ] Documentation updated, tested `make html` command in the `docs/`
folder.

---------

Signed-off-by: Wenqi Li <wenqil@nvidia.com>
Signed-off-by: Wenqi Li <831580+wyli@users.noreply.github.com>
Co-authored-by: YunLiu <55491388+KumoLiu@users.noreply.github.com>
@wyli wyli added the good first issue Good for newcomers label Aug 10, 2023
@ishandutta0098
Copy link
Contributor

@wyli is this issue still open for more assertion error changes?

@KumoLiu
Copy link
Contributor

KumoLiu commented Nov 15, 2023

Hi @ishandutta0098, yes. Welcome to contribute.

@vikashg vikashg closed this as completed Dec 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants