Skip to content

Exceptions

Framework-agnostic exceptions raised by services. The view boundary maps them to DRF responses — see Errors & atomic for the mapping.

ServiceError

Bases: Exception

Raised by services to signal a business-rule failure.

Carries an optional structured detail payload so the view layer can surface a meaningful response without the service depending on DRF.

ServiceValidationError

Bases: ServiceError

Raised by services to signal invalid input or invalid state.

The detail argument may be a string, a dict (field → error(s)), or a list of errors — mirroring DRF's own ValidationError payload shapes.