In a Java EE web app (JSF) I have an EJB that handles "edition" of an entity.
What exception do I have to throw in the case of this scenario:
I don't know what exception to throw. The EJB method will also be called remotely. This is why I am looking for an already implemented exception.
Perhaps use an IllegalStateException
:
Signals that a method has been invoked at an illegal or inappropriate time. In other words, the Java environment or Java application is not in an appropriate state for the requested operation.
Also poissible is ConcurrentModificationException
:
This exception may be thrown by methods that have detected concurrent modification of an object when such modification is not permissible.