I am new to the Java scene, but am currently working on a designated assessment. I am wondering if there is a way to catch an exception inside a class function and throw another exception, so a function called a class function should not know about the first exception.
for instance
public void foo() throws MasterException {
try {
int a = bar();
} catch (MasterException e) {
}
}
public void bar() throws MasterException, MinorException {
try {
int a = 1;
} catch (MinorException e) {
throw new MasterException();
}
}
Hope this example explains what I'm trying to achieve. Basically, I want the calling function not to know about MinorException.
Benji source
share