errors.py 437 B

12345678910111213141516
  1. # -*- coding: utf-8 -*-
  2. def error(msg: str, code: int) -> dict[str, object]:
  3. return {
  4. 'error': msg,
  5. 'code': code
  6. }
  7. class Error:
  8. USER_IS_NOT_EXISTS = error("User isn't exists", 1)
  9. ROLE_IS_NOT_EXISTS = error("This role is not exists", 2)
  10. EVENT_IS_NOT_EXISTS = error("This event is not exists", 3)
  11. LOGIN_IS_EXISTS = error("This login is used", 64)
  12. ACCEPT_DENIED = error("Accept denied", 500)