I have a Java Application code that has following custom Exception structure
SettlementException
extendsException
PolicyMissingException
extendsSettlementException
PolicyExpiredException
extendsSettlementException
I have some try/catch blocks in the code that try PolicyMissing
and PolicyExpired
and throw the same.
try
{
if (Policy != null)
{
...
}
else
{
throw new PolicyMissingException(“Policy missing”);
}
}
catch(PolicyMissingException e)
{
e.printstacktrace();
}
Is there any way I can throw SettlementException
too besides PolicyMissing
and PolicyExpired
along with them?