I was working on tuning in Java, and I was wondering if it is possible to find out which object threw the exception.
I know that if you make your custom exceptions, you can change the constructor and reference the object:
public class MyEx extends Throwable {
private MyObject object;
public MyEx(MyObject o){
super();
}
public MyObject getSource(){
return object;
}
}
but I don't know if there is another way to catch who chose the exception. Do you know any other way?
source
share