Skip to content

Only unwrap declared checked causes with UNWRAP#3359

Merged
velo merged 2 commits into
OpenFeign:masterfrom
young0264:fix/error-decoder-checked-exception
May 27, 2026
Merged

Only unwrap declared checked causes with UNWRAP#3359
velo merged 2 commits into
OpenFeign:masterfrom
young0264:fix/error-decoder-checked-exception

Conversation

@young0264
Copy link
Copy Markdown
Contributor

@young0264 young0264 commented May 14, 2026

Summary

This updates UNWRAP propagation so that Feign only rethrows:

  • RuntimeException and Error
  • checked exceptions declared by the target method, including assignable supertypes

Undeclared checked causes now remain wrapped in RetryableException.

Why

Previously, UNWRAP would rethrow any non-null cause from RetryableException.

That could rethrow checked exceptions that are not declared by the target method, which can lead to inconsistent exception propagation at the proxy boundary.

This keeps the fix at the core boundary instead of adding client-specific handling or synthesizing responses.

Tests

Added coverage for:

  • undeclared checked causes staying wrapped with UNWRAP
  • declared checked causes being unwrapped with UNWRAP
  • assignable checked causes being unwrapped with UNWRAP
  • the Apache HttpClient redirect-without-Location case staying wrapped as RetryableException

Fixes #1487

Copy link
Copy Markdown
Member

@velo velo left a comment

Choose a reason for hiding this comment

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

Thanks for the fix — this change is focused, includes targeted test updates, and looks backward-compatible and safe.

@velo velo merged commit f03867f into OpenFeign:master May 27, 2026
3 checks passed
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.

ErrorDecoder not invoked when Apache Http client throws checked exception

2 participants