Exceptions modified to take into account the type of the entity.
enter the commit message for your changes. Lines starting