From 0f285a7157085523f202bacce19e1ee9d6b62c7b 2011-02-22 17:37:32 From: MinRK <benjaminrk@gmail.com> Date: 2011-02-22 17:37:32 Subject: [PATCH] tweak exceptions in %precision --- diff --git a/IPython/core/magic.py b/IPython/core/magic.py index 2c9f62b..977c3f3 100644 --- a/IPython/core/magic.py +++ b/IPython/core/magic.py @@ -3504,15 +3504,15 @@ Defaulting color scheme to 'NoColor'""" fmt = s try: fmt%3.14159 - except: - raise TypeError("Precision must be int or format string, not %r"%s) + except Exception: + raise ValueError("Precision must be int or format string, not %r"%s) elif s: # otherwise, should be an int try: i = int(s) assert i >= 0 - except: - raise TypeError("Precision must be non-negative int or format string, not %r"%s) + except (ValueError, AssertionError): + raise ValueError("Precision must be non-negative int or format string, not %r"%s) fmt = '%%.%if'%i if 'numpy' in sys.modules: