from rest_framework.exceptions import APIException

class CustomAPIException(APIException):
  def __init__(self, detail = None):
    if detail: detail = f'{self.default_detail}: {detail}'
    else:      detail = self.default_detail

    super().__init__(detail)

class Misconfigured(CustomAPIException):
  status_code    = 412
  default_code   = 'misconfigured'
  default_detail = 'Misconfigured'

class MailSendingFailed(CustomAPIException):
  status_code    = 412
  default_code   = 'mail_sending_failed'
  default_detail = 'Mail sending failed'
