Permalink
Browse files

tweak exceptions in %precision

  • Loading branch information...
1 parent 637f887 commit 0f285a7157085523f202bacce19e1ee9d6b62c7b @minrk committed Feb 22, 2011
Showing with 4 additions and 4 deletions.
  1. +4 −4 IPython/core/magic.py
View
@@ -3504,15 +3504,15 @@ def magic_precision(self, s=''):
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:

0 comments on commit 0f285a7

Please sign in to comment.