Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Suppress exception chaining on rc validator failure. #15877

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

Merged
merged 1 commit into from
Dec 8, 2019

Conversation

anntzer
Copy link
Contributor

@anntzer anntzer commented Dec 8, 2019

This changes the traceback from

  Traceback (most recent call last):
    File ".../matplotlib/__init__.py", line 768, in __setitem__
      cval = self.validate[key](val)
    File ".../matplotlib/rcsetup.py", line 67, in __call__
      raise ValueError('Unrecognized %s string %r: valid strings are %s'
  ValueError: Unrecognized capstyle string 'foobar': valid strings are ['butt', 'round', 'projecting']

  During handling of the above exception, another exception occurred:

  Traceback (most recent call last):
    File "<string>", line 4, in <module>
    File ".../matplotlib/__init__.py", line 770, in __setitem__
      raise ValueError("Key %s: %s" % (key, str(ve)))
  ValueError: Key lines.solid_capstyle: Unrecognized capstyle string 'foobar': valid strings are ['butt', 'round', 'projecting']

to

  Traceback (most recent call last):
    File "<string>", line 4, in <module>
    File ".../matplotlib/__init__.py", line 770, in __setitem__
      raise ValueError(f"Key {key}: {ve}") from None
  ValueError: Key lines.solid_capstyle: Unrecognized capstyle string 'foobar': valid strings are ['butt', 'round', 'projecting']

PR Summary

PR Checklist

  • Has Pytest style unit tests
  • Code is Flake 8 compliant
  • New features are documented, with examples if plot related
  • Documentation is sphinx and numpydoc compliant
  • Added an entry to doc/users/next_whats_new/ if major new feature (follow instructions in README.rst there)
  • Documented in doc/api/api_changes.rst if API changed in a backward-incompatible way

This changes the traceback from

  Traceback (most recent call last):
    File ".../matplotlib/__init__.py", line 768, in __setitem__
      cval = self.validate[key](val)
    File ".../matplotlib/rcsetup.py", line 67, in __call__
      raise ValueError('Unrecognized %s string %r: valid strings are %s'
  ValueError: Unrecognized capstyle string 'foobar': valid strings are ['butt', 'round', 'projecting']

  During handling of the above exception, another exception occurred:

  Traceback (most recent call last):
    File "<string>", line 4, in <module>
    File ".../matplotlib/__init__.py", line 770, in __setitem__
      raise ValueError("Key %s: %s" % (key, str(ve)))
  ValueError: Key lines.solid_capstyle: Unrecognized capstyle string 'foobar': valid strings are ['butt', 'round', 'projecting']

to

  Traceback (most recent call last):
    File "<string>", line 4, in <module>
    File ".../matplotlib/__init__.py", line 770, in __setitem__
      raise ValueError(f"Key {key}: {ve}") from None
  ValueError: Key lines.solid_capstyle: Unrecognized capstyle string 'foobar': valid strings are ['butt', 'round', 'projecting']
@tacaswell tacaswell added this to the v3.3.0 milestone Dec 8, 2019
@tacaswell tacaswell merged commit bb3c0b5 into matplotlib:master Dec 8, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants