You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@dubbo.apache.org by "Snow-kal (via GitHub)" <gi...@apache.org> on 2026/01/28 12:28:57 UTC
[PR] feat(generic): add exception class handle [dubbo-go]
Snow-kal opened a new pull request, #3183:
URL: https://github.com/apache/dubbo-go/pull/3183
Add GenericException to retain Java exception type and message, and provide a unified conversion logic (supports DubboGenericException/Throwabler/legacy strings).
See hessian_response.go
Prioritize outputting GenericException in the response decoding path to avoid losing type information caused by returning only strings.
See hessian_response.go and hessian_dubbo.go
Support GenericException (pointer/value) in the response encoding path, and serialize it to the Java-side GenericException.
See hessian_response.go and hessian.go
Add unit tests to cover GenericException codec and compatibility with legacy string exceptions.
See hessian_test.go
-----------------------------------------------------------------------------------------------------------------------
新增 GenericException,保留 Java 异常类型与消息,并提供统一转换逻辑(支持 DubboGenericException/Throwabler/历史字符串)。
见 hessian_response.go
响应解码路径优先输出 GenericException,避免仅返回字符串导致类型信息丢失。
见 hessian_response.go 与 hessian_dubbo.go
响应编码路径支持 GenericException(指针/值),并序列化为 Java 侧 GenericException。
见 hessian_response.go 与 hessian.go
新增单测覆盖 GenericException 编解码与历史字符串异常兼容。
见 hessian_test.go
### Description
Related to https://github.com/apache/dubbo-go/issues/3167
### Checklist
- [ √] I confirm the target branch is `develop`
- [ √] Code has passed local testing
- [ √] I have added tests that prove my fix is effective or that my feature works
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org
Re: [PR] feat(generic): add exception class handle [dubbo-go]
Posted by "Snow-kal (via GitHub)" <gi...@apache.org>.
Snow-kal commented on code in PR #3183:
URL: https://github.com/apache/dubbo-go/pull/3183#discussion_r2740280346
##########
protocol/dubbo/hessian2/hessian_dubbo.go:
##########
@@ -240,9 +240,22 @@ func (h *HessianCodec) ReadBody(rspObj any) error {
}
rsp, ok := rspObj.(*DubboResponse)
if !ok {
- return perrors.Errorf("java exception:%s", exception.(string))
+ return perrors.Errorf("java exception:%v", exception)
Review Comment:
好滴 已修改!
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org
Re: [PR] feat(generic): add exception class handle [dubbo-go]
Posted by "sonarqubecloud[bot] (via GitHub)" <gi...@apache.org>.
sonarqubecloud[bot] commented on PR #3183:
URL: https://github.com/apache/dubbo-go/pull/3183#issuecomment-3816422908
## [](https://sonarcloud.io/dashboard?id=apache_dubbo-go&pullRequest=3183) **Quality Gate passed**
Issues
 [2 New issues](https://sonarcloud.io/project/issues?id=apache_dubbo-go&pullRequest=3183&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)
 [0 Accepted issues](https://sonarcloud.io/project/issues?id=apache_dubbo-go&pullRequest=3183&issueStatuses=ACCEPTED)
Measures
 [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_dubbo-go&pullRequest=3183&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)
 [0.0% Coverage on New Code](https://sonarcloud.io/component_measures?id=apache_dubbo-go&pullRequest=3183&metric=new_coverage&view=list)
 [16.9% Duplication on New Code](https://sonarcloud.io/component_measures?id=apache_dubbo-go&pullRequest=3183&metric=new_duplicated_lines_density&view=list)
[See analysis details on SonarQube Cloud](https://sonarcloud.io/dashboard?id=apache_dubbo-go&pullRequest=3183)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org
Re: [PR] feat(generic): add exception class handle [dubbo-go]
Posted by "sonarqubecloud[bot] (via GitHub)" <gi...@apache.org>.
sonarqubecloud[bot] commented on PR #3183:
URL: https://github.com/apache/dubbo-go/pull/3183#issuecomment-3811388085
## [](https://sonarcloud.io/dashboard?id=apache_dubbo-go&pullRequest=3183) **Quality Gate passed**
Issues
 [2 New issues](https://sonarcloud.io/project/issues?id=apache_dubbo-go&pullRequest=3183&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)
 [0 Accepted issues](https://sonarcloud.io/project/issues?id=apache_dubbo-go&pullRequest=3183&issueStatuses=ACCEPTED)
Measures
 [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_dubbo-go&pullRequest=3183&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)
 [0.0% Coverage on New Code](https://sonarcloud.io/component_measures?id=apache_dubbo-go&pullRequest=3183&metric=new_coverage&view=list)
 [17.1% Duplication on New Code](https://sonarcloud.io/component_measures?id=apache_dubbo-go&pullRequest=3183&metric=new_duplicated_lines_density&view=list)
[See analysis details on SonarQube Cloud](https://sonarcloud.io/dashboard?id=apache_dubbo-go&pullRequest=3183)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org
Re: [PR] feat(generic): add exception class handle [dubbo-go]
Posted by "Alanxtl (via GitHub)" <gi...@apache.org>.
Alanxtl commented on code in PR #3183:
URL: https://github.com/apache/dubbo-go/pull/3183#discussion_r2740769680
##########
protocol/dubbo/impl/hessian.go:
##########
@@ -425,9 +433,7 @@ func getArgType(v any) string {
}
switch v := v.(type) {
- // Serialized tags for base types
- case nil:
- return "V"
Review Comment:
why delete these
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org
Re: [PR] feat(generic): add exception class handle [dubbo-go]
Posted by "sonarqubecloud[bot] (via GitHub)" <gi...@apache.org>.
sonarqubecloud[bot] commented on PR #3183:
URL: https://github.com/apache/dubbo-go/pull/3183#issuecomment-3816305370
## [](https://sonarcloud.io/dashboard?id=apache_dubbo-go&pullRequest=3183) **Quality Gate passed**
Issues
 [2 New issues](https://sonarcloud.io/project/issues?id=apache_dubbo-go&pullRequest=3183&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)
 [0 Accepted issues](https://sonarcloud.io/project/issues?id=apache_dubbo-go&pullRequest=3183&issueStatuses=ACCEPTED)
Measures
 [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_dubbo-go&pullRequest=3183&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)
 [0.0% Coverage on New Code](https://sonarcloud.io/component_measures?id=apache_dubbo-go&pullRequest=3183&metric=new_coverage&view=list)
 [17.3% Duplication on New Code](https://sonarcloud.io/component_measures?id=apache_dubbo-go&pullRequest=3183&metric=new_duplicated_lines_density&view=list)
[See analysis details on SonarQube Cloud](https://sonarcloud.io/dashboard?id=apache_dubbo-go&pullRequest=3183)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org
Re: [PR] feat(generic): add exception class handle [dubbo-go]
Posted by "sonarqubecloud[bot] (via GitHub)" <gi...@apache.org>.
sonarqubecloud[bot] commented on PR #3183:
URL: https://github.com/apache/dubbo-go/pull/3183#issuecomment-3816228720
## [](https://sonarcloud.io/dashboard?id=apache_dubbo-go&pullRequest=3183) **Quality Gate passed**
Issues
 [2 New issues](https://sonarcloud.io/project/issues?id=apache_dubbo-go&pullRequest=3183&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)
 [0 Accepted issues](https://sonarcloud.io/project/issues?id=apache_dubbo-go&pullRequest=3183&issueStatuses=ACCEPTED)
Measures
 [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_dubbo-go&pullRequest=3183&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)
 [0.0% Coverage on New Code](https://sonarcloud.io/component_measures?id=apache_dubbo-go&pullRequest=3183&metric=new_coverage&view=list)
 [17.4% Duplication on New Code](https://sonarcloud.io/component_measures?id=apache_dubbo-go&pullRequest=3183&metric=new_duplicated_lines_density&view=list)
[See analysis details on SonarQube Cloud](https://sonarcloud.io/dashboard?id=apache_dubbo-go&pullRequest=3183)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org
Re: [PR] feat(generic): add exception class handle [dubbo-go]
Posted by "sonarqubecloud[bot] (via GitHub)" <gi...@apache.org>.
sonarqubecloud[bot] commented on PR #3183:
URL: https://github.com/apache/dubbo-go/pull/3183#issuecomment-3816380548
## [](https://sonarcloud.io/dashboard?id=apache_dubbo-go&pullRequest=3183) **Quality Gate passed**
Issues
 [2 New issues](https://sonarcloud.io/project/issues?id=apache_dubbo-go&pullRequest=3183&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)
 [0 Accepted issues](https://sonarcloud.io/project/issues?id=apache_dubbo-go&pullRequest=3183&issueStatuses=ACCEPTED)
Measures
 [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_dubbo-go&pullRequest=3183&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)
 [0.0% Coverage on New Code](https://sonarcloud.io/component_measures?id=apache_dubbo-go&pullRequest=3183&metric=new_coverage&view=list)
 [17.2% Duplication on New Code](https://sonarcloud.io/component_measures?id=apache_dubbo-go&pullRequest=3183&metric=new_duplicated_lines_density&view=list)
[See analysis details on SonarQube Cloud](https://sonarcloud.io/dashboard?id=apache_dubbo-go&pullRequest=3183)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org
Re: [PR] feat(generic): add exception class handle [dubbo-go]
Posted by "sonarqubecloud[bot] (via GitHub)" <gi...@apache.org>.
sonarqubecloud[bot] commented on PR #3183:
URL: https://github.com/apache/dubbo-go/pull/3183#issuecomment-3816357604
## [](https://sonarcloud.io/dashboard?id=apache_dubbo-go&pullRequest=3183) **Quality Gate passed**
Issues
 [2 New issues](https://sonarcloud.io/project/issues?id=apache_dubbo-go&pullRequest=3183&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)
 [0 Accepted issues](https://sonarcloud.io/project/issues?id=apache_dubbo-go&pullRequest=3183&issueStatuses=ACCEPTED)
Measures
 [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_dubbo-go&pullRequest=3183&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)
 [0.0% Coverage on New Code](https://sonarcloud.io/component_measures?id=apache_dubbo-go&pullRequest=3183&metric=new_coverage&view=list)
 [17.2% Duplication on New Code](https://sonarcloud.io/component_measures?id=apache_dubbo-go&pullRequest=3183&metric=new_duplicated_lines_density&view=list)
[See analysis details on SonarQube Cloud](https://sonarcloud.io/dashboard?id=apache_dubbo-go&pullRequest=3183)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org
Re: [PR] feat(generic): add exception class handle [dubbo-go]
Posted by "Snow-kal (via GitHub)" <gi...@apache.org>.
Snow-kal commented on code in PR #3183:
URL: https://github.com/apache/dubbo-go/pull/3183#discussion_r2745747425
##########
protocol/dubbo/hessian2/hessian_response.go:
##########
@@ -41,6 +41,51 @@ type DubboResponse struct {
Attachments map[string]any
}
+// GenericException keeps Java exception class and message.
+type GenericException struct {
Review Comment:
我觉得也可以,如果要做的话等我调研一下那个项目
所以现在是先保持这样做还是要干别的
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org
Re: [PR] feat(generic): add exception class handle [dubbo-go]
Posted by "sonarqubecloud[bot] (via GitHub)" <gi...@apache.org>.
sonarqubecloud[bot] commented on PR #3183:
URL: https://github.com/apache/dubbo-go/pull/3183#issuecomment-3811369918
## [](https://sonarcloud.io/dashboard?id=apache_dubbo-go&pullRequest=3183) **Quality Gate passed**
Issues
 [2 New issues](https://sonarcloud.io/project/issues?id=apache_dubbo-go&pullRequest=3183&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)
 [0 Accepted issues](https://sonarcloud.io/project/issues?id=apache_dubbo-go&pullRequest=3183&issueStatuses=ACCEPTED)
Measures
 [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_dubbo-go&pullRequest=3183&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)
 [0.0% Coverage on New Code](https://sonarcloud.io/component_measures?id=apache_dubbo-go&pullRequest=3183&metric=new_coverage&view=list)
 [17.1% Duplication on New Code](https://sonarcloud.io/component_measures?id=apache_dubbo-go&pullRequest=3183&metric=new_duplicated_lines_density&view=list)
[See analysis details on SonarQube Cloud](https://sonarcloud.io/dashboard?id=apache_dubbo-go&pullRequest=3183)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org
Re: [PR] feat(generic): add exception class handle [dubbo-go]
Posted by "AlexStocks (via GitHub)" <gi...@apache.org>.
AlexStocks commented on code in PR #3183:
URL: https://github.com/apache/dubbo-go/pull/3183#discussion_r2744354361
##########
protocol/dubbo/hessian2/hessian_response.go:
##########
@@ -41,6 +41,51 @@ type DubboResponse struct {
Attachments map[string]any
}
+// GenericException keeps Java exception class and message.
+type GenericException struct {
Review Comment:
这个放入 dubbo-go-hessian2 项目是不是更合适?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org
Re: [PR] feat(generic): add exception class handle [dubbo-go]
Posted by "AlexStocks (via GitHub)" <gi...@apache.org>.
AlexStocks commented on code in PR #3183:
URL: https://github.com/apache/dubbo-go/pull/3183#discussion_r2749400516
##########
protocol/dubbo/hessian2/hessian_response.go:
##########
@@ -41,6 +41,51 @@ type DubboResponse struct {
Attachments map[string]any
}
+// GenericException keeps Java exception class and message.
+type GenericException struct {
Review Comment:
我先给你 merge 了,你去记个 issue 别忘记这事
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org
Re: [PR] feat(generic): add exception class handle [dubbo-go]
Posted by "Snow-kal (via GitHub)" <gi...@apache.org>.
Snow-kal commented on code in PR #3183:
URL: https://github.com/apache/dubbo-go/pull/3183#discussion_r2740297266
##########
protocol/dubbo/hessian2/hessian_response.go:
##########
Review Comment:
感谢建议,已按照意见修改,修改该后逻辑
```
switch ex := response.Exception.(type) {
case *GenericException:
err = encoder.Encode(java_exception.NewDubboGenericException(ex.ExceptionClass, ex.ExceptionMessage))
case GenericException:
err = encoder.Encode(java_exception.NewDubboGenericException(ex.ExceptionClass, ex.ExceptionMessage))
case java_exception.Throwabler:
err = encoder.Encode(ex)
default:
err = encoder.Encode(java_exception.NewThrowable(response.Exception.Error()))
}
if err != nil {
return nil, perrors.Errorf("encoding exception failed: %v", err)
}
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org
Re: [PR] feat(generic): add exception class handle [dubbo-go]
Posted by "codecov-commenter (via GitHub)" <gi...@apache.org>.
codecov-commenter commented on PR #3183:
URL: https://github.com/apache/dubbo-go/pull/3183#issuecomment-3811132416
## [Codecov](https://app.codecov.io/gh/apache/dubbo-go/pull/3183?dropdown=coverage&src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) Report
:x: Patch coverage is `32.00000%` with `34 lines` in your changes missing coverage. Please review.
:white_check_mark: Project coverage is 48.45%. Comparing base ([`60d1c2a`](https://app.codecov.io/gh/apache/dubbo-go/commit/60d1c2a949f0ee0da4be3fe09fb79d295491e040?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)) to head ([`5215fa7`](https://app.codecov.io/gh/apache/dubbo-go/commit/5215fa716115136e345449d4f6b918a2674fb900?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)).
:warning: Report is 723 commits behind head on develop.
| [Files with missing lines](https://app.codecov.io/gh/apache/dubbo-go/pull/3183?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Patch % | Lines |
|---|---|---|
| [protocol/dubbo/hessian2/hessian\_response.go](https://app.codecov.io/gh/apache/dubbo-go/pull/3183?src=pr&el=tree&filepath=protocol%2Fdubbo%2Fhessian2%2Fhessian_response.go&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-cHJvdG9jb2wvZHViYm8vaGVzc2lhbjIvaGVzc2lhbl9yZXNwb25zZS5nbw==) | 28.57% | [22 Missing and 3 partials :warning: ](https://app.codecov.io/gh/apache/dubbo-go/pull/3183?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
| [protocol/dubbo/hessian2/hessian\_dubbo.go](https://app.codecov.io/gh/apache/dubbo-go/pull/3183?src=pr&el=tree&filepath=protocol%2Fdubbo%2Fhessian2%2Fhessian_dubbo.go&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-cHJvdG9jb2wvZHViYm8vaGVzc2lhbjIvaGVzc2lhbl9kdWJiby5nbw==) | 28.57% | [4 Missing and 1 partial :warning: ](https://app.codecov.io/gh/apache/dubbo-go/pull/3183?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
| [protocol/dubbo/impl/hessian.go](https://app.codecov.io/gh/apache/dubbo-go/pull/3183?src=pr&el=tree&filepath=protocol%2Fdubbo%2Fimpl%2Fhessian.go&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-cHJvdG9jb2wvZHViYm8vaW1wbC9oZXNzaWFuLmdv) | 50.00% | [1 Missing and 3 partials :warning: ](https://app.codecov.io/gh/apache/dubbo-go/pull/3183?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
<details><summary>Additional details and impacted files</summary>
```diff
@@ Coverage Diff @@
## develop #3183 +/- ##
===========================================
+ Coverage 46.76% 48.45% +1.68%
===========================================
Files 295 461 +166
Lines 17172 33436 +16264
===========================================
+ Hits 8031 16201 +8170
- Misses 8287 15924 +7637
- Partials 854 1311 +457
```
</details>
[:umbrella: View full report in Codecov by Sentry](https://app.codecov.io/gh/apache/dubbo-go/pull/3183?dropdown=coverage&src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).
:loudspeaker: Have feedback on the report? [Share it here](https://about.codecov.io/codecov-pr-comment-feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).
<details><summary> :rocket: New features to boost your workflow: </summary>
- :snowflake: [Test Analytics](https://docs.codecov.com/docs/test-analytics): Detect flaky tests, report on failures, and find test suite problems.
</details>
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org
Re: [PR] feat(generic): add exception class handle [dubbo-go]
Posted by "Snow-kal (via GitHub)" <gi...@apache.org>.
Snow-kal commented on code in PR #3183:
URL: https://github.com/apache/dubbo-go/pull/3183#discussion_r2736527218
##########
protocol/dubbo/hessian2/hessian_response.go:
##########
@@ -41,6 +41,51 @@ type DubboResponse struct {
Attachments map[string]any
}
+// GenericException keeps Java exception class and message.
+type GenericException struct {
+ ExceptionClass string
+ ExceptionMessage string
+}
+
+// Error returns a readable error string.
+func (e GenericException) Error() string {
+ if e.ExceptionClass == "" {
+ return e.ExceptionMessage
+ }
+ if e.ExceptionMessage == "" {
+ return e.ExceptionClass
+ }
+ return "java exception: " + e.ExceptionClass + " - " + e.ExceptionMessage
+}
Review Comment:
已修改
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org
Re: [PR] feat(generic): add exception class handle [dubbo-go]
Posted by "sonarqubecloud[bot] (via GitHub)" <gi...@apache.org>.
sonarqubecloud[bot] commented on PR #3183:
URL: https://github.com/apache/dubbo-go/pull/3183#issuecomment-3811304631
## [](https://sonarcloud.io/dashboard?id=apache_dubbo-go&pullRequest=3183) **Quality Gate passed**
Issues
 [2 New issues](https://sonarcloud.io/project/issues?id=apache_dubbo-go&pullRequest=3183&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)
 [0 Accepted issues](https://sonarcloud.io/project/issues?id=apache_dubbo-go&pullRequest=3183&issueStatuses=ACCEPTED)
Measures
 [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_dubbo-go&pullRequest=3183&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)
 [0.0% Coverage on New Code](https://sonarcloud.io/component_measures?id=apache_dubbo-go&pullRequest=3183&metric=new_coverage&view=list)
 [17.2% Duplication on New Code](https://sonarcloud.io/component_measures?id=apache_dubbo-go&pullRequest=3183&metric=new_duplicated_lines_density&view=list)
[See analysis details on SonarQube Cloud](https://sonarcloud.io/dashboard?id=apache_dubbo-go&pullRequest=3183)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org
Re: [PR] feat(generic): add exception class handle [dubbo-go]
Posted by "Snow-kal (via GitHub)" <gi...@apache.org>.
Snow-kal commented on code in PR #3183:
URL: https://github.com/apache/dubbo-go/pull/3183#discussion_r2740268225
##########
protocol/dubbo/hessian2/hessian_dubbo.go:
##########
@@ -240,9 +240,22 @@ func (h *HessianCodec) ReadBody(rspObj any) error {
}
rsp, ok := rspObj.(*DubboResponse)
if !ok {
- return perrors.Errorf("java exception:%s", exception.(string))
+ return perrors.Errorf("java exception:%v", exception)
+ }
+ if g, ok := ToGenericException(exception); ok {
+ rsp.Exception = g
+ } else if e, ok := exception.(error); ok {
+ rsp.Exception = e
+ } else {
+ rsp.Exception = perrors.Errorf("java exception:%v", exception)
+ }
+ if g, ok := ToGenericException(exception); ok {
+ rsp.Exception = g
+ } else if e, ok := exception.(error); ok {
+ rsp.Exception = e
+ } else {
+ rsp.Exception = perrors.Errorf("java exception:%v", exception)
}
Review Comment:
已更改 我的问题,应该是之前按 copilot 修改的时候多复制了,感谢建议
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org
Re: [PR] feat(generic): add exception class handle [dubbo-go]
Posted by "Snow-kal (via GitHub)" <gi...@apache.org>.
Snow-kal commented on code in PR #3183:
URL: https://github.com/apache/dubbo-go/pull/3183#discussion_r2740260391
##########
protocol/dubbo/impl/hessian_test.go:
##########
@@ -485,6 +486,45 @@ func TestMarshalResponse(t *testing.T) {
assert.NotNil(t, data)
})
+ t.Run("response with generic exception", func(t *testing.T) {
+ encoder := hessian.NewEncoder()
+ pkg := DubboPackage{
+ Header: DubboHeader{
+ Type: PackageResponse,
+ ResponseStatus: Response_OK,
+ },
+ Body: &ResponsePayload{
+ Exception: hessian2.GenericException{
+ ExceptionClass: "com.example.UserNotFoundException",
+ ExceptionMessage: "用户不存在",
Review Comment:
OK 已更改
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org
Re: [PR] feat(generic): add exception class handle [dubbo-go]
Posted by "Copilot (via GitHub)" <gi...@apache.org>.
Copilot commented on code in PR #3183:
URL: https://github.com/apache/dubbo-go/pull/3183#discussion_r2736436801
##########
protocol/dubbo/hessian2/hessian_response.go:
##########
@@ -41,6 +41,51 @@ type DubboResponse struct {
Attachments map[string]any
}
+// GenericException keeps Java exception class and message.
+type GenericException struct {
+ ExceptionClass string
+ ExceptionMessage string
+}
+
+// Error returns a readable error string.
+func (e GenericException) Error() string {
+ if e.ExceptionClass == "" {
+ return e.ExceptionMessage
+ }
+ if e.ExceptionMessage == "" {
+ return e.ExceptionClass
+ }
+ return "java exception: " + e.ExceptionClass + " - " + e.ExceptionMessage
+}
Review Comment:
`GenericException.Error()` formats messages as `"java exception: " + class + " - " + message`, which is inconsistent with existing error formatting in this repo (`"java exception:%s"` with no extra spaces, e.g. `protocol/dubbo/impl/codec.go:176`) and also makes legacy-string errors change their `.Error()` output. Consider aligning the formatting (and potentially treating the legacy-string / `java.lang.Exception` case specially) to avoid breaking existing callers/tests that compare error strings.
##########
protocol/dubbo/hessian2/hessian_dubbo.go:
##########
@@ -240,9 +240,15 @@ func (h *HessianCodec) ReadBody(rspObj any) error {
}
rsp, ok := rspObj.(*DubboResponse)
if !ok {
- return perrors.Errorf("java exception:%s", exception.(string))
+ return perrors.Errorf("java exception:%v", exception)
+ }
+ if g, ok := ToGenericException(exception); ok {
+ rsp.Exception = g
+ } else if e, ok := exception.(error); ok {
+ rsp.Exception = e
+ } else {
+ rsp.Exception = perrors.Errorf("java exception:%v", exception)
}
Review Comment:
`ReadBody` now prioritizes `ToGenericException(exception)` for `PackageResponse_Exception`. When `exception` is the legacy string body used for non-OK response statuses, this changes the resulting `Exception.Error()` format (e.g., adds class / different prefix formatting), which breaks existing expectations (see `protocol/dubbo/hessian2/hessian_dubbo_test.go:107-110`). Consider preserving the previous behavior for this path (e.g., keep `perrors.Errorf("java exception:%s", s)` for string exceptions / non-OK statuses), or adjust `GenericException.Error()` to remain backward-compatible for the legacy-string case.
##########
protocol/dubbo/hessian2/hessian_response.go:
##########
@@ -41,6 +41,51 @@ type DubboResponse struct {
Attachments map[string]any
}
+// GenericException keeps Java exception class and message.
+type GenericException struct {
+ ExceptionClass string
+ ExceptionMessage string
+}
+
+// Error returns a readable error string.
+func (e GenericException) Error() string {
+ if e.ExceptionClass == "" {
+ return e.ExceptionMessage
+ }
+ if e.ExceptionMessage == "" {
+ return e.ExceptionClass
+ }
+ return "java exception: " + e.ExceptionClass + " - " + e.ExceptionMessage
+}
+
+// ToGenericException converts decoded exception to GenericException when possible.
+func ToGenericException(expt any) (*GenericException, bool) {
+ switch v := expt.(type) {
+ case *GenericException:
+ return v, true
+ case GenericException:
+ return &v, true
+ case *java_exception.DubboGenericException:
+ return &GenericException{ExceptionClass: v.ExceptionClass, ExceptionMessage: v.ExceptionMessage}, true
+ case java_exception.DubboGenericException:
+ return &GenericException{ExceptionClass: v.ExceptionClass, ExceptionMessage: v.ExceptionMessage}, true
+ case java_exception.Throwabler:
+ return &GenericException{ExceptionClass: v.JavaClassName(), ExceptionMessage: v.Error()}, true
+ case string:
+ return parseLegacyException(v), true
Review Comment:
`ToGenericException` converts any `java_exception.Throwabler` into `GenericException`, which drops throwable-specific details such as stack traces and prevents downstream code from type-asserting the error (e.g. `proxy/proxy.go:209` logs `Throwabler.GetStackTrace()`). Unless the intent is to always erase the original throwable type, consider not converting `Throwabler` here (only handle `DubboGenericException` + legacy strings), or preserving the original throwable as the error cause while exposing `GenericException` metadata separately.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org
Re: [PR] feat(generic): add exception class handle [dubbo-go]
Posted by "Snow-kal (via GitHub)" <gi...@apache.org>.
Snow-kal commented on code in PR #3183:
URL: https://github.com/apache/dubbo-go/pull/3183#discussion_r2740805154
##########
protocol/dubbo/impl/hessian.go:
##########
@@ -425,9 +433,7 @@ func getArgType(v any) string {
}
switch v := v.(type) {
- // Serialized tags for base types
- case nil:
- return "V"
Review Comment:
是这样的 我看它上面已经有了
` if v == nil { return "V" } `
所以 下面这段代码在 case nil 是不会达到的,所以就删了而且 IDE 静态检查出了这个问题
```
// Serialized tags for base types
case nil:
return "V"
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org
Re: [PR] feat(generic): add exception class handle [dubbo-go]
Posted by "Snow-kal (via GitHub)" <gi...@apache.org>.
Snow-kal commented on code in PR #3183:
URL: https://github.com/apache/dubbo-go/pull/3183#discussion_r2740297266
##########
protocol/dubbo/hessian2/hessian_response.go:
##########
Review Comment:
感谢建议,已按照意见修改,修改该后逻辑
```
switch ex := response.Exception.(type) {
case *GenericException:
err = encoder.Encode(java_exception.NewDubboGenericException(ex.ExceptionClass, ex.ExceptionMessage))
case GenericException:
err = encoder.Encode(java_exception.NewDubboGenericException(ex.ExceptionClass, ex.ExceptionMessage))
case java_exception.Throwabler:
err = encoder.Encode(ex)
default:
err = encoder.Encode(java_exception.NewThrowable(response.Exception.Error()))
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org
Re: [PR] feat(generic): add exception class handle [dubbo-go]
Posted by "sonarqubecloud[bot] (via GitHub)" <gi...@apache.org>.
sonarqubecloud[bot] commented on PR #3183:
URL: https://github.com/apache/dubbo-go/pull/3183#issuecomment-3816140323
## [](https://sonarcloud.io/dashboard?id=apache_dubbo-go&pullRequest=3183) **Quality Gate passed**
Issues
 [2 New issues](https://sonarcloud.io/project/issues?id=apache_dubbo-go&pullRequest=3183&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)
 [0 Accepted issues](https://sonarcloud.io/project/issues?id=apache_dubbo-go&pullRequest=3183&issueStatuses=ACCEPTED)
Measures
 [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_dubbo-go&pullRequest=3183&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)
 [0.0% Coverage on New Code](https://sonarcloud.io/component_measures?id=apache_dubbo-go&pullRequest=3183&metric=new_coverage&view=list)
 [17.8% Duplication on New Code](https://sonarcloud.io/component_measures?id=apache_dubbo-go&pullRequest=3183&metric=new_duplicated_lines_density&view=list)
[See analysis details on SonarQube Cloud](https://sonarcloud.io/dashboard?id=apache_dubbo-go&pullRequest=3183)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org
Re: [PR] feat(generic): add exception class handle [dubbo-go]
Posted by "sonarqubecloud[bot] (via GitHub)" <gi...@apache.org>.
sonarqubecloud[bot] commented on PR #3183:
URL: https://github.com/apache/dubbo-go/pull/3183#issuecomment-3811198595
## [](https://sonarcloud.io/dashboard?id=apache_dubbo-go&pullRequest=3183) **Quality Gate passed**
Issues
 [2 New issues](https://sonarcloud.io/project/issues?id=apache_dubbo-go&pullRequest=3183&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)
 [0 Accepted issues](https://sonarcloud.io/project/issues?id=apache_dubbo-go&pullRequest=3183&issueStatuses=ACCEPTED)
Measures
 [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_dubbo-go&pullRequest=3183&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)
 [0.0% Coverage on New Code](https://sonarcloud.io/component_measures?id=apache_dubbo-go&pullRequest=3183&metric=new_coverage&view=list)
 [17.3% Duplication on New Code](https://sonarcloud.io/component_measures?id=apache_dubbo-go&pullRequest=3183&metric=new_duplicated_lines_density&view=list)
[See analysis details on SonarQube Cloud](https://sonarcloud.io/dashboard?id=apache_dubbo-go&pullRequest=3183)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org
Re: [PR] feat(generic): add exception class handle [dubbo-go]
Posted by "Snow-kal (via GitHub)" <gi...@apache.org>.
Snow-kal commented on code in PR #3183:
URL: https://github.com/apache/dubbo-go/pull/3183#discussion_r2736511554
##########
protocol/dubbo/hessian2/hessian_dubbo.go:
##########
@@ -240,9 +240,15 @@ func (h *HessianCodec) ReadBody(rspObj any) error {
}
rsp, ok := rspObj.(*DubboResponse)
if !ok {
- return perrors.Errorf("java exception:%s", exception.(string))
+ return perrors.Errorf("java exception:%v", exception)
+ }
+ if g, ok := ToGenericException(exception); ok {
+ rsp.Exception = g
+ } else if e, ok := exception.(error); ok {
+ rsp.Exception = e
+ } else {
+ rsp.Exception = perrors.Errorf("java exception:%v", exception)
}
Review Comment:
已经按照建议修改
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org
Re: [PR] feat(generic): add exception class handle [dubbo-go]
Posted by "Snow-kal (via GitHub)" <gi...@apache.org>.
Snow-kal commented on PR #3183:
URL: https://github.com/apache/dubbo-go/pull/3183#issuecomment-3811452151
为什么更改 cluster/cluster/failback/cluster_test.go 文件的原因
测试 TestFailbackRetryFailed10Times 失败了。从日志中可以看到:
核心问题:
测试创建了 10 个失败任务,每个任务都需要重试
但任务队列容量太小(只有 1),导致出现 tasklist is too full > 1 警告
队列满了之后,后续的重试任务无法入队,导致测试行为不符合预期
最终测试失败,因为预期的重试次数没有达到
日志中的关键错误:
Code
2026-01-28T13:27:05.976Z ERROR failback/cluster_invoker.go:195
Failed retry to invoke the method in the service com.ikurento.user.UserProvider,
wait again. The exception: error
2026-01-28T13:27:05.976Z WARN failback/cluster_invoker.go:154
tasklist is too full > 1.
解决方案:
增加队列容量 至20
为什么设置为 20:
10 个初始失败任务
每个任务至少会重试一次,可能会同时存在于队列中
设置为 20 可以确保有足够的缓冲空间
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org
Re: [PR] feat(generic): add exception class handle [dubbo-go]
Posted by "sonarqubecloud[bot] (via GitHub)" <gi...@apache.org>.
sonarqubecloud[bot] commented on PR #3183:
URL: https://github.com/apache/dubbo-go/pull/3183#issuecomment-3811106391
## [](https://sonarcloud.io/dashboard?id=apache_dubbo-go&pullRequest=3183) **Quality Gate passed**
Issues
 [1 New issue](https://sonarcloud.io/project/issues?id=apache_dubbo-go&pullRequest=3183&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)
 [0 Accepted issues](https://sonarcloud.io/project/issues?id=apache_dubbo-go&pullRequest=3183&issueStatuses=ACCEPTED)
Measures
 [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_dubbo-go&pullRequest=3183&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)
 [0.0% Coverage on New Code](https://sonarcloud.io/component_measures?id=apache_dubbo-go&pullRequest=3183&metric=new_coverage&view=list)
 [18.2% Duplication on New Code](https://sonarcloud.io/component_measures?id=apache_dubbo-go&pullRequest=3183&metric=new_duplicated_lines_density&view=list)
[See analysis details on SonarQube Cloud](https://sonarcloud.io/dashboard?id=apache_dubbo-go&pullRequest=3183)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org
Re: [PR] feat(generic): add exception class handle [dubbo-go]
Posted by "sonarqubecloud[bot] (via GitHub)" <gi...@apache.org>.
sonarqubecloud[bot] commented on PR #3183:
URL: https://github.com/apache/dubbo-go/pull/3183#issuecomment-3811041919
## [](https://sonarcloud.io/dashboard?id=apache_dubbo-go&pullRequest=3183) **Quality Gate passed**
Issues
 [1 New issue](https://sonarcloud.io/project/issues?id=apache_dubbo-go&pullRequest=3183&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)
 [0 Accepted issues](https://sonarcloud.io/project/issues?id=apache_dubbo-go&pullRequest=3183&issueStatuses=ACCEPTED)
Measures
 [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_dubbo-go&pullRequest=3183&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)
 [0.0% Coverage on New Code](https://sonarcloud.io/component_measures?id=apache_dubbo-go&pullRequest=3183&metric=new_coverage&view=list)
 [18.3% Duplication on New Code](https://sonarcloud.io/component_measures?id=apache_dubbo-go&pullRequest=3183&metric=new_duplicated_lines_density&view=list)
[See analysis details on SonarQube Cloud](https://sonarcloud.io/dashboard?id=apache_dubbo-go&pullRequest=3183)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org
Re: [PR] feat(generic): add exception class handle [dubbo-go]
Posted by "Alanxtl (via GitHub)" <gi...@apache.org>.
Alanxtl commented on code in PR #3183:
URL: https://github.com/apache/dubbo-go/pull/3183#discussion_r2739554167
##########
protocol/dubbo/hessian2/hessian_response.go:
##########
Review Comment:
use switch instead
##########
protocol/dubbo/hessian2/hessian_dubbo.go:
##########
@@ -240,9 +240,22 @@ func (h *HessianCodec) ReadBody(rspObj any) error {
}
rsp, ok := rspObj.(*DubboResponse)
if !ok {
- return perrors.Errorf("java exception:%s", exception.(string))
+ return perrors.Errorf("java exception:%v", exception)
Review Comment:
```suggestion
return perrors.Errorf("java exception: %v", exception)
```
##########
protocol/dubbo/impl/hessian_test.go:
##########
@@ -485,6 +486,45 @@ func TestMarshalResponse(t *testing.T) {
assert.NotNil(t, data)
})
+ t.Run("response with generic exception", func(t *testing.T) {
+ encoder := hessian.NewEncoder()
+ pkg := DubboPackage{
+ Header: DubboHeader{
+ Type: PackageResponse,
+ ResponseStatus: Response_OK,
+ },
+ Body: &ResponsePayload{
+ Exception: hessian2.GenericException{
+ ExceptionClass: "com.example.UserNotFoundException",
+ ExceptionMessage: "用户不存在",
Review Comment:
全使用英文
##########
protocol/dubbo/hessian2/hessian_dubbo.go:
##########
@@ -240,9 +240,22 @@ func (h *HessianCodec) ReadBody(rspObj any) error {
}
rsp, ok := rspObj.(*DubboResponse)
if !ok {
- return perrors.Errorf("java exception:%s", exception.(string))
+ return perrors.Errorf("java exception:%v", exception)
+ }
+ if g, ok := ToGenericException(exception); ok {
+ rsp.Exception = g
+ } else if e, ok := exception.(error); ok {
+ rsp.Exception = e
+ } else {
+ rsp.Exception = perrors.Errorf("java exception:%v", exception)
+ }
+ if g, ok := ToGenericException(exception); ok {
+ rsp.Exception = g
+ } else if e, ok := exception.(error); ok {
+ rsp.Exception = e
+ } else {
+ rsp.Exception = perrors.Errorf("java exception:%v", exception)
}
Review Comment:
为什么这段代码重复了两次
##########
protocol/dubbo/impl/hessian.go:
##########
@@ -85,7 +86,11 @@ func marshalResponse(encoder *hessian.Encoder, p DubboPackage) ([]byte, error) {
if response.Exception != nil { // throw error
_ = encoder.Encode(resWithException)
- if t, ok := response.Exception.(java_exception.Throwabler); ok {
+ if g, ok := response.Exception.(*hessian2.GenericException); ok {
+ _ = encoder.Encode(java_exception.NewDubboGenericException(g.ExceptionClass, g.ExceptionMessage))
+ } else if g, ok := response.Exception.(hessian2.GenericException); ok {
+ _ = encoder.Encode(java_exception.NewDubboGenericException(g.ExceptionClass, g.ExceptionMessage))
+ } else if t, ok := response.Exception.(java_exception.Throwabler); ok {
_ = encoder.Encode(t)
} else {
_ = encoder.Encode(java_exception.NewThrowable(response.Exception.Error()))
Review Comment:
ditto
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org
Re: [PR] feat(generic): add exception class handle [dubbo-go]
Posted by "Snow-kal (via GitHub)" <gi...@apache.org>.
Snow-kal commented on code in PR #3183:
URL: https://github.com/apache/dubbo-go/pull/3183#discussion_r2740313483
##########
protocol/dubbo/impl/hessian.go:
##########
@@ -85,7 +86,11 @@ func marshalResponse(encoder *hessian.Encoder, p DubboPackage) ([]byte, error) {
if response.Exception != nil { // throw error
_ = encoder.Encode(resWithException)
- if t, ok := response.Exception.(java_exception.Throwabler); ok {
+ if g, ok := response.Exception.(*hessian2.GenericException); ok {
+ _ = encoder.Encode(java_exception.NewDubboGenericException(g.ExceptionClass, g.ExceptionMessage))
+ } else if g, ok := response.Exception.(hessian2.GenericException); ok {
+ _ = encoder.Encode(java_exception.NewDubboGenericException(g.ExceptionClass, g.ExceptionMessage))
+ } else if t, ok := response.Exception.(java_exception.Throwabler); ok {
_ = encoder.Encode(t)
} else {
_ = encoder.Encode(java_exception.NewThrowable(response.Exception.Error()))
Review Comment:
已修改,修改该之后的代码
```
switch ex := response.Exception.(type) {
case *hessian2.GenericException:
_ = encoder.Encode(java_exception.NewDubboGenericException(ex.ExceptionClass, ex.ExceptionMessage))
case hessian2.GenericException:
_ = encoder.Encode(java_exception.NewDubboGenericException(ex.ExceptionClass, ex.ExceptionMessage))
case java_exception.Throwabler:
_ = encoder.Encode(ex)
default:
_ = encoder.Encode(java_exception.NewThrowable(response.Exception.Error()))
}
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org
Re: [PR] feat(generic): add exception class handle [dubbo-go]
Posted by "sonarqubecloud[bot] (via GitHub)" <gi...@apache.org>.
sonarqubecloud[bot] commented on PR #3183:
URL: https://github.com/apache/dubbo-go/pull/3183#issuecomment-3816064177
## [](https://sonarcloud.io/dashboard?id=apache_dubbo-go&pullRequest=3183) **Quality Gate passed**
Issues
 [2 New issues](https://sonarcloud.io/project/issues?id=apache_dubbo-go&pullRequest=3183&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)
 [0 Accepted issues](https://sonarcloud.io/project/issues?id=apache_dubbo-go&pullRequest=3183&issueStatuses=ACCEPTED)
Measures
 [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_dubbo-go&pullRequest=3183&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)
 [0.0% Coverage on New Code](https://sonarcloud.io/component_measures?id=apache_dubbo-go&pullRequest=3183&metric=new_coverage&view=list)
 [17.2% Duplication on New Code](https://sonarcloud.io/component_measures?id=apache_dubbo-go&pullRequest=3183&metric=new_duplicated_lines_density&view=list)
[See analysis details on SonarQube Cloud](https://sonarcloud.io/dashboard?id=apache_dubbo-go&pullRequest=3183)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org
Re: [PR] feat(generic): add exception class handle [dubbo-go]
Posted by "AlexStocks (via GitHub)" <gi...@apache.org>.
AlexStocks merged PR #3183:
URL: https://github.com/apache/dubbo-go/pull/3183
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org