Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Throw the original exception when fallback or blockHandler method is invoked in annotation support #986

Merged
merged 1 commit into from
Aug 28, 2019

Conversation

huangxfchn
Copy link
Contributor

@huangxfchn huangxfchn commented Aug 14, 2019

AbstractSentinelAspectSupport#handleFallback should throw original Exception rather than InvocationTargetException.

Does this pull request fix one issue?

Fixes #985

Describe how you did it

try {
    if (isStatic(fallbackMethod)) {
        return fallbackMethod.invoke(null, args);
    }
    return fallbackMethod.invoke(pjp.getTarget(), args);
} catch (InvocationTargetException e) {
    // throw the actual exception
    throw e.getTargetException();
}

Describe how to verify it

run all Tests in sentinel-annotation-aspectj/src/test/java/com.alibaba.csp.sentinel.annotation.aspectj`.

@CLAassistant
Copy link

CLAassistant commented Aug 14, 2019

CLA assistant check
All committers have signed the CLA.

@sczyh30
Copy link
Member

sczyh30 commented Aug 14, 2019

Hi, could you please sign the CLA?
https://cla-assistant.io/alibaba/Sentinel?pullRequest=986

Copy link
Member

@sczyh30 sczyh30 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you please add a test case for your case?

@sczyh30
Copy link
Member

sczyh30 commented Aug 14, 2019

And you could sync with the latest upstream/master? There were test failures in the previous master.

@sczyh30 sczyh30 added area/annotation Issues or PRs related to annotation support to-review To review labels Aug 14, 2019
@huangxfchn
Copy link
Contributor Author

And you could sync with the latest upstream/master? There were test failures in the previous master.

OK, I will improve this pr.

@sczyh30
Copy link
Member

sczyh30 commented Aug 17, 2019

Hi, any progress? :)

@sczyh30
Copy link
Member

sczyh30 commented Aug 20, 2019

Friendly ping :)

Copy link
Member

@sczyh30 sczyh30 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@sczyh30 sczyh30 merged commit 4916ec3 into alibaba:master Aug 28, 2019
@sczyh30 sczyh30 removed the to-review To review label Aug 28, 2019
@sczyh30 sczyh30 added this to the 1.7.0 milestone Aug 28, 2019
@sczyh30 sczyh30 changed the title throw the actual exception when fallback method was invoked. (#985) Throw the original exception when fallback or blockHandler method is invoked in annotation support Aug 28, 2019
CST11021 pushed a commit to CST11021/Sentinel that referenced this pull request Nov 3, 2021
[RIP-9] Remove unnecessary dots for Design_Trancation.md
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/annotation Issues or PRs related to annotation support
Projects
None yet
Development

Successfully merging this pull request may close these issues.

AbstractSentinelAspectSupport#handleFallback should throw original Exception
3 participants