Announcement Announcement Module
No announcement yet.
How can I intercept a exception just when it occurred? Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • How can I intercept a exception just when it occurred?

    Some code like this:
    public class A {
      private B b;  
      public void a() {
        //AAA: some logic process that maybe throw exception
    public class B {
      public void b() {
        //BBB: some logic process maybe also throw exception
    Both exceptions in A.a() and B.b() need to be intercept, so i use @AfterThrowing annotation do it. but the question is, when i call A.a() in other code and exception has occurred in B.b(), the Advice will execute twice! because exception that occurred in B.b() was propagating to its caller A.a().

    I can't swallow the exception silently, because i use spring-amqp, above codes is on Consumer side, i need some message processing that based on the exceptions that occurred in Consumer.

    So, How can i intercept a exception just when it occurred? ignore propagation of it.

    Any reply is greatly appreciated.

  • #2
    Anyone help me? will be appreciated.


    • #3
      Dose anyone can help me out of this?


      • #4
        I feel lonely in this forum.