jwmu_exceptions.py 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. # This file is part of jwmud, written by Helmut Pozimski in 2014.
  2. #
  3. # jwmud is free software: you can redistribute it and/or modify
  4. # it under the terms of the GNU General Public License as published by
  5. # the Free Software Foundation, version 2 of the License.
  6. #
  7. # jwmud is distributed in the hope that it will be useful,
  8. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10. # GNU General Public License for more details.
  11. #
  12. # You should have received a copy of the GNU General Public License
  13. # along with jwmud. If not, see <http://www.gnu.org/licenses/>.
  14. # -*- coding: utf8 -*-
  15. class DataBaseAccessFailed(Exception):
  16. def __init__(self):
  17. self.__message = "Accessing the database failed!"
  18. def __str__(self):
  19. return self.__message
  20. class DataBaseWriteFailed(Exception):
  21. def __init__(self):
  22. self.__message = "Writing to the database failed, requested action " \
  23. "aborted !"
  24. def __str__(self):
  25. return self.__message
  26. class WrongParameters(Exception):
  27. def __init__(self):
  28. self.__message = "The wrong number or values of parameters where " \
  29. "given to the function, the requested action failed."
  30. def __str__(self):
  31. return self.__message
  32. class CategoryNotFound(Exception):
  33. def __init__(self):
  34. self.__message = "The category could not be found in the database."
  35. def __str__(self):
  36. return self.__message
  37. class DayAlreadyInDatabase(Exception):
  38. def __init__(self):
  39. self.__message = "This day already exists in the database."
  40. def __str__(self):
  41. return self.__message
  42. class ConfigurationFileMissing(Exception):
  43. def __init__(self):
  44. self.__message = "The configuration file does not exist."
  45. def __str__(self):
  46. return self.__message
  47. class ConfigurationFileAccessDenied(Exception):
  48. def __init__(self):
  49. self.__message = "The configuration file could not be opened " \
  50. "for reading."
  51. def __str__(self):
  52. return self.__message