Suppose I have the code below that needs to throw an exception from withing an anonymous function without modifying the function:
FOO.doSomething(new Transactable(){
public void run(FOO foo) {
// How to proxy a exception throw
// from here, without modifying the class
}
});
Like:
@Override
public void run() throws MyCustomException{
FOO.doSomething(new Transactable(){
public void run(FOO foo) {
// How to proxy a exception throw
// from here, without modifying the class
}
});
}
I have some doubts that I understood this correctly, but here’s my shot. I guess you’re trying to somehow move the exception from the anonymous class and throw it from the parent method: