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

Improve DefaultDubboFallback implementation(apache-dubbo-adapter). #2176

Closed

Conversation

wuwen5
Copy link
Contributor

@wuwen5 wuwen5 commented Apr 29, 2021

Describe what this PR does / why we need it

The caller cannot determine the type of runtime exception thrown.
I suggest the same way as sentinel-dubbo-adapter(dubbo-2.6.x).

Does this pull request fix one issue?

#1252

@sczyh30
Copy link
Member

sczyh30 commented Apr 30, 2021

Hi, thanks for contributing. The exception type has been carried in the message of the wrapped RuntimeException. SentinelRpcException is not recommended any more.

@wuwen5
Copy link
Contributor Author

wuwen5 commented Apr 30, 2021

SentinelRpcException is a subclass of RuntimeException so callers can capture and judge it easily, while RuntimeException (ex.toRuntimeException()) can only be captured and judged by error message, which is very unfriendly.

try {...
} catch (RuntimeException e) {
 if (e.getMessage().contains("SentinelBlockException")) {
                //...
  }
}
try {
} catch (SentinelRpcException e) {
  // is friendly
}

@wuwen5 wuwen5 closed this May 28, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants