Should I throw IllegalArgmentException when 'user of given id not exist'?
Say we have a method changeUserName(Long id,String newName) which invokes
the repository's findUser(Long id) to find the right user entity and then
change its name.
Is it appropriate to thow an IllegalArgmentException when findUser returns
null ?
Or should I instead throw a custom UserNotExistException (extends
AppException extends RuntimeException) ?
No comments:
Post a Comment