regarding 404: I would create a custom ResourceNotFoundException and have my domain exceptions extend ResourceNotFoundException such that UserNotFoundException extends ResourceNotFoundException
Then I can configure my framework to catch and handle any ResourceNotFoundException by throwing a 404 http status code.
But I agree with you that our "Domain" should know nothing of the transport, and a "404 code" is very-much a transport-specific construct
regarding 404: I would create a custom ResourceNotFoundException and have my domain exceptions extend ResourceNotFoundException such that UserNotFoundException extends ResourceNotFoundException
Then I can configure my framework to catch and handle any ResourceNotFoundException by throwing a 404 http status code.
But I agree with you that our "Domain" should know nothing of the transport, and a "404 code" is very-much a transport-specific construct
Thank you. It is a great idea about ResourceNotFoundException. As far I remember there is a 404 code for UserWasNotFound in the presentation :)