Tried @AfterThrowing in aspcet and what I understand is, its executed from the calling point as soon as there is exception but the exception still remains unhandled for example
now if getReport() is adviced by afterThrowing and it throws some exception then afterThrowing is invoked and then control goes to catch,is there a way we can handle the exception in AfterThrowing advice?
code for getReport throwing exception
code for @AfterThrowing
I know this can be achived by @Around advice by putting proceed method in try catch, but can same be done without it?
All desirable things in life are either illegal, banned, expensive or married to someone else !!!
Praful Thakare wrote:ah okay, but would have been nicer if it was possible to do so, yes Around seems to be one stop shop, nothing else really required...
Actually, it wouldn't be nicer. Only Around makes the developer responsible for exceptions, calling the target and returning the object returned from the target. All four other advices don't put those requirements on the developer and makes it nicer and easier.