خطاها¶
این صفحه از docstringهای خود کد ساخته میشود، که به انگلیسیاند.
exceptions
¶
A project's own errors, and the common ones the library ships.
A DomainError is DRF's APIException with one thing added: data,
what a client can act on - which record is in the way, how long to wait:
class ProvinceInUse(DomainError):
status_code = 409
default_code = 'province_in_use'
default_detail = _('This province has branches and cannot be deleted.')
raise ProvinceInUse(data={'branches': 3})
Its names are DRF's own: default_code is sent as error_code,
default_detail as message. Being an APIException, it answers
sensibly under DRF's own handler too, and a Celery task or a management
command catches it like any other exception.
Where DRF has an exception of the same meaning, the library's is also that
exception - NotFoundError is a NotFound - so code that catches DRF's,
and DRF's own handling of it, keep working.
DomainError
¶
Bases: APIException
A rule of the project was broken, said in the envelope with data beside it.
InvalidInputError
¶
InvalidCursorError
¶
InvalidCursorError(detail: Any = None, code: str | None = None, *, data: Mapping[str, Any] | None = None)
Bases: DomainError
A cursor the server cannot read: the client sent back something it was never given.