fieldenms / tg

Trident Genesis
MIT License
14 stars 7 forks source link

Entity deletion: improve exception handling #2240

Closed 01es closed 3 months ago

01es commented 3 months ago

Description

There are multiple places in the code that pertain to deletion, which try to catch exception of type org.hibernate.exception.ConstraintViolationException. Although this exception gets thrown, it is wrapped by Hibernate into javax.persistence.PersistenceException, and so no org.hibernate.exception.ConstraintViolationException can be caught in practice.

The implementation of deletion needs to be inspected and adjusted to actually catch exceptions due to violations of DB constraints, so that these can be reported to users in a friendly manner.

Expected outcome

More reliable handling of DB constraint violations, providing a more user-friendly message in case of such violations when users try to delete some entities.