Consider API is implemented in REST.
I would like to avoid using http_status_code 2xx,3xx,4xx,5xx; simply to understand which is better between exception and status values.
Approach-1] Throw Exception
- IllegalArgumentException
- DependentServiceTimeoutException
- UnauthorizedOperationException
Approach-2] Return Status
- OK
- INVALID_PARAMETER
- DEPENDENCY_FAILURE
Which is better approach in terms of design principles and best practices?
Aucun commentaire:
Enregistrer un commentaire