exceptions.py 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. # -*- coding: utf-8 -*-
  2. """
  3. (c) 2014 - Copyright Red Hat Inc
  4. Authors:
  5. Pierre-Yves Chibon <pingou@pingoured.fr>
  6. """
  7. class PagureException(Exception):
  8. ''' Parent class of all the exception for all Pagure specific
  9. exceptions.
  10. '''
  11. pass
  12. class RepoExistsException(PagureException):
  13. ''' Exception thrown when trying to create a repository that already
  14. exists.
  15. '''
  16. pass
  17. class FileNotFoundException(PagureException):
  18. ''' Exception thrown when trying to create a repository that already
  19. exists.
  20. '''
  21. pass
  22. class APIError(PagureException):
  23. ''' Exception raised by the API when something goes wrong. '''
  24. def __init__(self, status_code, error_code, error=None):
  25. self.status_code = status_code
  26. self.error_code = error_code
  27. self.error = error
  28. class BranchNotFoundException(PagureException):
  29. ''' Exception thrown when trying to use a branch that could not be
  30. found in a repository.
  31. '''
  32. pass
  33. class PagureEvException(PagureException):
  34. ''' Exceptions used in the pagure_stream_server.
  35. '''
  36. pass
  37. class GitConflictsException(PagureException):
  38. ''' Exception used when trying to pull on a repo and that leads to
  39. conflicts.
  40. '''
  41. pass
  42. class HookInactiveException(PagureException):
  43. ''' Exception raised when the hook is inactive. '''
  44. pass
  45. class NoCorrespondingPR(PagureException):
  46. ''' Exception raised when no pull-request is found with the given
  47. information. '''
  48. pass
  49. class InvalidObjectException(PagureException):
  50. ''' Exception raised when a given object is not what was expected. '''
  51. pass