PageRenderTime 50ms CodeModel.GetById 29ms RepoModel.GetById 1ms app.codeStats 0ms

/oerplib/error.py

https://bitbucket.org/nhomar/python-oerplib
Python | 62 lines | 25 code | 19 blank | 18 comment | 0 complexity | bb0202a31377ff4e0dc5c1fafaa3ea70 MD5 | raw file
Possible License(s): LGPL-3.0
  1. # -*- coding: UTF-8 -*-
  2. """This module contains all exceptions raised by `OERPLib` when an error
  3. occurred.
  4. """
  5. #import traceback, sys
  6. class Error(Exception):
  7. def __init__(self, message, oerp_traceback=False):
  8. super(Error, self).__init__()
  9. self.oerp_traceback = oerp_traceback
  10. self.message = message
  11. #self.tb = sys.exc_info()[2]
  12. def __str__(self):
  13. #traceback.print_tb(self.tb)
  14. return u"{message}".format(message=self.message)
  15. class DMSConnectionError(Error):
  16. pass
  17. class LoginError(Error):
  18. """Exception raised when an error occurred during a login operation."""
  19. pass
  20. class ExecuteQueryError(Error):
  21. """Exception raised when an error occurred during an execute query."""
  22. pass
  23. class WorkflowQueryError(Error):
  24. """Exception raised when an error occurred during an workflow query."""
  25. pass
  26. class ReportError(Error):
  27. """Exception raised when an error occurred during a retrieval
  28. report operation.
  29. """
  30. pass
  31. class InternalError(Error):
  32. """Exception raised when an error occurred during an internal operation."""
  33. pass
  34. class NotAllowedError(Error):
  35. """Exception raised if a prohibited operation is made."""
  36. def __init__(self, message):
  37. super(NotAllowedError, self).__init__(message)
  38. class UnknownError(Error):
  39. """Exception raised when an unknown error occurred."""
  40. def __init__(self, message):
  41. super(UnknownError, self).__init__(message)
  42. # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: