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

Improve the error message of partial methods #461

Closed
qqfunc opened this issue Apr 29, 2024 · 3 comments
Closed

Improve the error message of partial methods #461

qqfunc opened this issue Apr 29, 2024 · 3 comments
Labels
enhancement New features, or improvements to existing features.

Comments

@qqfunc
Copy link
Contributor

qqfunc commented Apr 29, 2024

What is the problem or limitation you are having?

The current error message is as follows:

>>> obj.someMethod(..., invalidArg=...)
Traceback (most recent call last):
    ...
ValueError: No method was found starting with 'someMethod' and with keywords {'invalidArg'}
Known keywords are:
frozenset({''})
frozenset({'', 'validArg'})

This will be as follows after #453 is resolved because frozenset will be changed to tuple:

ValueError: No method was found starting with 'someMethod' and with keywords ('invalidArg')
Known keywords are:
('')
('', 'validArg')

Describe the solution you'd like

I think the converted selector name and available selector names should be shown.

ValueError: Invalid selector 'someMethod:invalidArg:'. Available selectors are: 'someMethod:', 'someMethod:validArg:'

Describe alternatives you've considered

It is also possible to show descriptions of Python, not selectors.

ValueError: Invalid method 'someMethod(..., invalidArg=...)'. Available methods are: 'someMethod(...)', 'someMethod(..., validArg=...)'

Actual values of arguments are represented as ....

Additional context

No response

@qqfunc qqfunc added the enhancement New features, or improvements to existing features. label Apr 29, 2024
@freakboy3742
Copy link
Member

Agreed this would be a good improvement - especially if it were paired with an implementation of #453 and #148.

Of the two syntax options you've presented, I'd lean towards the "selector" description - any user is trying to invoke an ObjC method, so I don't think we gain anything by trying to avoid ObjC syntax in error messages.

@qqfunc
Copy link
Contributor Author

qqfunc commented Apr 30, 2024

Thanks for agreeing. I will try it with the issues.

@qqfunc qqfunc mentioned this issue Apr 30, 2024
4 tasks
@freakboy3742
Copy link
Member

Fixed by #462.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New features, or improvements to existing features.
Projects
None yet
Development

No branches or pull requests

2 participants