##// END OF EJS Templates
Tidy up error raising in magic decorators....
Thomas Kluyver -
Show More
@@ -203,8 +203,8 b' def _method_magic_marker(magic_kind):'
203 return decorator(call, func)
203 return decorator(call, func)
204 retval = mark
204 retval = mark
205 else:
205 else:
206 raise ValueError("Decorator can only be called with "
206 raise TypeError("Decorator can only be called with "
207 "string or function")
207 "string or function")
208 return retval
208 return retval
209
209
210 # Ensure the resulting decorator has a usable docstring
210 # Ensure the resulting decorator has a usable docstring
@@ -229,7 +229,8 b' def _function_magic_marker(magic_kind):'
229 if get_ipython is not None:
229 if get_ipython is not None:
230 break
230 break
231 else:
231 else:
232 raise('Decorator can only run in context where `get_ipython` exists')
232 raise NameError('Decorator can only run in context where '
233 '`get_ipython` exists')
233
234
234 ip = get_ipython()
235 ip = get_ipython()
235
236
@@ -247,7 +248,7 b' def _function_magic_marker(magic_kind):'
247 return decorator(call, func)
248 return decorator(call, func)
248 retval = mark
249 retval = mark
249 else:
250 else:
250 raise ValueError("Decorator can only be called with "
251 raise TypeError("Decorator can only be called with "
251 "string or function")
252 "string or function")
252 return retval
253 return retval
253
254
General Comments 0
You need to be logged in to leave comments. Login now