Link to home
Start Free TrialLog in
Avatar of directxBOB
directxBOBFlag for Ireland

asked on

Custom Exception Help

I have an application that has several types of custom exceptions.

Each method has several different types of exceptions that they can throw.

The code has 3 steps which are 3 places I want to catch exceptions:

ValidateParameters
Setup Account Info Object (Account service could be offline)
GetAccountInfo (accounInfo server could be down etc)

Just wondering the best way to do this, should I put a try catch block instead of the if statement or should I go ahead and place a try catch within Validate ParamDetails?

The I would assume just a try catch around the other 2 would do the job?

Cheers
//1. Validate Parameters
if (validateViolation1.ValidateParamDetails())
{
//2. Setup Account Info
AccountInfoServices.AccountInfo accountInfo = new AccountInfo();
 
//3. Account Info
accountInfo = accountInfoServices.GetAccountInfo();
 
}

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of evilrix
evilrix
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial