Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7839159
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T15:21:04+00:00 2026-06-02T15:21:04+00:00

I have a problem. Namely: I’m using spring aop to handle exceptions. Some of

  • 0

I have a problem.

Namely: I’m using spring aop to handle exceptions. Some of them are my exceptions that are being thrown in case of corrupted data delivered by outside vendor. I handle them in aspects pointed to certain type. Such as this one.

@AfterThrowing(
    pointcut =
      "execution(*myClass.myDataProcessingMethod(..))",
    throwing = "ex"
  )
public void myAspectMethod(MyException ex) {
...
}

But when something bad happends in my data processing job, and it isn’t faulty data but bug in my logic, I want to be informed on instance. So i have a second aspect.

@AfterThrowing(
    pointcut =
      "execution(*myClass.myDataProcessingMethod(..))",
    throwing = "ex"
  )
public void myAspectMethod(Exception ex) {
  extraInformingService.informAdamAtOnce("shitjustgotreal");
} 

But when MyException is thrown both aspects are fired because MyException is instance of Exception to.

Is there a way to fire only the method that points to MyException ?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-02T15:21:05+00:00Added an answer on June 2, 2026 at 3:21 pm

    The easiest, albeit not very elegant version is this:

    @AfterThrowing(
        pointcut =
          "execution(*myClass.myDataProcessingMethod(..))",
        throwing = "ex"
      )
    public void myAspectMethod(Exception ex) {
      if(!ex instanceof Myexception){
          extraInformingService.informAdamAtOnce("shitjustgotreal");
      }
    } 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a fiddle located here illustrating my problem, namely that when I load
I have a c++ program using gstreamer. The problem is that several of my
I have some XML that has creating using an XmlDocument object in C#. I
I have a problem with a Dev Express component, namely AspxComboBox. My context is
I have problem creating new instance of excel 2007 using VBA (from Access 2002).
I have problem with fancybox. I want to write a function that will run
i have problem with libhid . i found that there 2 way 4 accessing
We have a program which perform graph analysis (namely Maximum-flow problem) on several graphs.
I'm having a problem right now, I have 2 domain classes namely Doctor and
I have an interesting database problem. I have a DB that is 150GB in

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.