When DeniedAlwaysException extends DeniedException, the exceptions must be caught in the correct order, with DeniedAlwaysException always first, because DeniedAlwaysException is also a DeniedException and if it's first in the catch stack, the DeniedAlwaysException block will never be called.
The solution is to have them each extend Exception instead.
When
DeniedAlwaysExceptionextendsDeniedException, the exceptions must be caught in the correct order, withDeniedAlwaysExceptionalways first, becauseDeniedAlwaysExceptionis also aDeniedExceptionand if it's first in the catch stack, theDeniedAlwaysExceptionblock will never be called.The solution is to have them each extend Exception instead.