Skip to content

[AI-8th] Add RFC 7807 ProblemDetail support for SOFA exceptions#1421

Open
pmupkin wants to merge 3 commits intosofastack:masterfrom
pmupkin:support-problemdetail
Open

[AI-8th] Add RFC 7807 ProblemDetail support for SOFA exceptions#1421
pmupkin wants to merge 3 commits intosofastack:masterfrom
pmupkin:support-problemdetail

Conversation

@pmupkin
Copy link
Copy Markdown

@pmupkin pmupkin commented Apr 23, 2026

This PR(Related issue #1403) adds a first-class ProblemDetail integration for SOFABoot so SOFA-specific exceptions can be returned as standardized RFC 7807 error responses.

It introduces:

  • dedicated exception handlers for ServiceRuntimeException and SofaBootRpcRuntimeException
  • safer compatibility with existing Spring and user-defined exception handling by avoiding a global Exception.class catch-all
  • refined RPC-to-HTTP status mapping, distinguishing local RPC configuration errors from remote/service-availability failures
  • regression tests covering auto-configuration, property binding, @ResponseStatus compatibility, custom @ControllerAdvice coexistence, and RPC error scenarios

@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 28, 2026

Codecov Report

❌ Patch coverage is 96.26168% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 83.19%. Comparing base (459b02f) to head (99d1d9c).
⚠️ Report is 1 commits behind head on master.

Files with missing lines Patch % Lines
...nfigure/web/SofaProblemDetailExceptionHandler.java 93.22% 0 Missing and 4 partials ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##             master    #1421      +/-   ##
============================================
+ Coverage     82.94%   83.19%   +0.25%     
- Complexity     2975     3036      +61     
============================================
  Files           340      345       +5     
  Lines          9833     9940     +107     
  Branches       1178     1194      +16     
============================================
+ Hits           8156     8270     +114     
+ Misses         1163     1155       -8     
- Partials        514      515       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Comment on lines +48 to +57
static final URI ABOUT_BLANK = URI.create("about:blank");
static final URI RUNTIME_EXCEPTION_TYPE = URI
.create("https://sofastack.io/errors/runtime-exception");
static final URI RPC_EXCEPTION_TYPE = URI
.create("https://sofastack.io/errors/rpc-exception");
static final URI RPC_CONFIGURATION_TYPE = URI
.create("https://sofastack.io/errors/rpc-configuration-exception");

private static final Pattern ERROR_CODE_PATTERN = Pattern
.compile("(SOFA-BOOT-\\d{2}-\\d{5})");
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

At present, none of these error types exist and the relevant descriptions need to be removed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants