I have two options in storing Error mesages for exception handling in our current assignment.Can u people suggest me which following ways of Exception Handling can be choosen in Performance Consideration?
1) Having a ErrDesc.java whose object is created inside each and every throws block by sending appropriate error code.
public class ErrDesc { public String getDesc(int errorid) { String errdesc=""; if ((errorid > 100) && (errorid < 200)) { switch(errorid) { case 101: errdesc = "[component1]ErrorDesc1" break; } } else if((errorid > 200) && (errorid < 300)) { switch(errorid) { case 201: errdesc = "[component2]ErrorDesc2" break; } } . . } }
2) Having ErrDesc.java which has each error code and error message as below.
public final static String errorcode101 = "errormesg101"; public final static String errorcode201 = "errormesg201"; . . . These messages can be captured from the caller java classes, by just specifying ErrDesc.errorcode101.