I'm quite convinced that UserException
probably extends ProfileException
. If you modified it, it's probable that the IDE did not compiled the latest version (for instance because compiler errors occured). Therefore you can run a clean and build command (available in most popular IDEs).
You can simply resolve the problem by swapping the catch
blocks:
try {
Long result = helperObj.getSomething();
} catch(UserException uEx) {
//Handle user exception
} catch(ProfileException pEx) {
//Handle profile exception
}
Most IDE's however will always write catch
blocks from specific types toward more general types in order to prevent such dead code.