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 error message for bad kwargs #167

Merged
merged 1 commit into from
Feb 28, 2021

Conversation

tlambert03
Copy link
Member

@tlambert03 tlambert03 commented Feb 28, 2021

closes #165

magicgui assumes all "extra" kwargs are parameter specific options. but a typo gives a cryptic error message

@magicgui(presist=False)
def a(b: float):
    print("O_O")
TypeError: 'param_options' must be a dict of dicts

This PR improves that a bit, by naming the specific parameters that were unrecognized:

ValueError: Received parameter option key(s) {'presist'} that do not match parameters in the provided function: (x: int, y='df')

@codecov
Copy link

codecov bot commented Feb 28, 2021

Codecov Report

Merging #167 (1e38091) into master (72c5ef6) will increase coverage by 0.06%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #167      +/-   ##
==========================================
+ Coverage   90.50%   90.57%   +0.06%     
==========================================
  Files          29       29              
  Lines        2802     2800       -2     
==========================================
  Hits         2536     2536              
+ Misses        266      264       -2     
Impacted Files Coverage Δ
magicgui/signature.py 96.55% <ø> (+2.29%) ⬆️
magicgui/widgets/_function_gui.py 96.91% <100.00%> (-0.04%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 72c5ef6...1e38091. Read the comment docs.

@tlambert03 tlambert03 merged commit 069ea2c into pyapp-kit:master Feb 28, 2021
@tlambert03 tlambert03 deleted the better-error branch February 28, 2021 21:08
@tlambert03 tlambert03 added the enhancement New feature or request label Apr 3, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Better error message on bad keyword argument to magicgui
1 participant