error.py 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. # encoding: utf-8
  2. """
  3. Global exception classes for IPython.core.
  4. Authors:
  5. * Brian Granger
  6. * Fernando Perez
  7. * Min Ragan-Kelley
  8. Notes
  9. -----
  10. """
  11. #-----------------------------------------------------------------------------
  12. # Copyright (C) 2008 The IPython Development Team
  13. #
  14. # Distributed under the terms of the BSD License. The full license is in
  15. # the file COPYING, distributed as part of this software.
  16. #-----------------------------------------------------------------------------
  17. #-----------------------------------------------------------------------------
  18. # Imports
  19. #-----------------------------------------------------------------------------
  20. #-----------------------------------------------------------------------------
  21. # Exception classes
  22. #-----------------------------------------------------------------------------
  23. class IPythonCoreError(Exception):
  24. pass
  25. class TryNext(IPythonCoreError):
  26. """Try next hook exception.
  27. Raise this in your hook function to indicate that the next hook handler
  28. should be used to handle the operation.
  29. """
  30. class UsageError(IPythonCoreError):
  31. """Error in magic function arguments, etc.
  32. Something that probably won't warrant a full traceback, but should
  33. nevertheless interrupt a macro / batch file.
  34. """
  35. class StdinNotImplementedError(IPythonCoreError, NotImplementedError):
  36. """raw_input was requested in a context where it is not supported
  37. For use in IPython kernels, where only some frontends may support
  38. stdin requests.
  39. """
  40. class InputRejected(Exception):
  41. """Input rejected by ast transformer.
  42. Raise this in your NodeTransformer to indicate that InteractiveShell should
  43. not execute the supplied input.
  44. """