A
Artie
Hi,
Is there a best practice for handling repeated code in Exception catch
blocks?
If I have
try
{
}
catch( VerySpecificException e)
{
// do a;
// do b;
// do c;
// do VerySpecific stuff
}
catch( SpecificException e)
{
// do a;
// do b;
// do c;
// do Specific stuff
}
catch (GeneralException e)
{
// do a;
// do b;
// do c;
// do General stuff
}
and each of these catch blocks does tasks a, b and c, then does their
own specific handling, what is the best way to not have to repeat a, b
and c in each block?
Could I call another method to do a, b, c or is there a more elegant
way of handling this?
Any help much appreciated
Thanks
Artie
Is there a best practice for handling repeated code in Exception catch
blocks?
If I have
try
{
}
catch( VerySpecificException e)
{
// do a;
// do b;
// do c;
// do VerySpecific stuff
}
catch( SpecificException e)
{
// do a;
// do b;
// do c;
// do Specific stuff
}
catch (GeneralException e)
{
// do a;
// do b;
// do c;
// do General stuff
}
and each of these catch blocks does tasks a, b and c, then does their
own specific handling, what is the best way to not have to repeat a, b
and c in each block?
Could I call another method to do a, b, c or is there a more elegant
way of handling this?
Any help much appreciated
Thanks
Artie