Skip to content

fix(java_exception): populate dubbo generic exception message#396

Open
leno23 wants to merge 3 commits into
apache:masterfrom
leno23:codex/generic-exception-detail-message
Open

fix(java_exception): populate dubbo generic exception message#396
leno23 wants to merge 3 commits into
apache:masterfrom
leno23:codex/generic-exception-detail-message

Conversation

@leno23

@leno23 leno23 commented Jun 9, 2026

Copy link
Copy Markdown

Description

Related to apache/dubbo-go#3361 and apache/dubbo-go#3378.

This PR completes the hessian2-side part of moving Dubbo generic exception handling into dubbo-go-hessian2. DubboGenericException already carries ExceptionClass and ExceptionMessage; this change makes the constructor and Error() expose a stable detail message from those fields so callers do not need to duplicate message formatting in dubbo-go.

The behavior remains compatible with decoded Java exceptions: when DetailMessage is already populated by decoding, Error() keeps returning that decoded detail. When it is empty, Error() falls back to the generic exception class/message formatting that dubbo-go previously implemented locally.

Validation

  • go test ./java_exception
  • go test . -run TestException
  • go test ./...
  • git diff --check
  • local audit script (OVERALL_EXIT=0)

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR updates DubboGenericException to expose a stable error detail message derived from ExceptionClass/ExceptionMessage when DetailMessage is not already populated (e.g., by decoding), so downstream callers don’t need to duplicate formatting logic.

Changes:

  • Populate DetailMessage in NewDubboGenericException using a shared message formatter.
  • Update DubboGenericException.Error() to prefer decoded DetailMessage, with a fallback to formatted class/message.
  • Add unit tests covering constructor behavior and Error() fallback/preference rules.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
java_exception/dubbo_generic_exception.go Sets/derives a stable error message for DubboGenericException via constructor + Error() fallback formatting.
java_exception/dubbo_generic_exception_test.go Adds tests verifying message formatting, fallback behavior, and decoded detail preference.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread java_exception/dubbo_generic_exception.go
Comment thread java_exception/dubbo_generic_exception_test.go
@CAICAIIs

Copy link
Copy Markdown

pls fix ci error

@Alanxtl

Alanxtl commented Jun 14, 2026

Copy link
Copy Markdown
Member

@Snow-kal @xxs588 help review this and #396

@leno23

leno23 commented Jun 15, 2026

Copy link
Copy Markdown
Author

Fixed the CI formatting failure by applying the imports-formatter result to java_exception/dubbo_generic_exception_test.go. Local validation passes: go test ./java_exception, go test ./..., and git diff --check.

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.

[FEATURE] Migrate GenericException from dubbo-go to dubbo-go-hessian2

5 participants