Skip to content

Only unwrap declared checked causes with UNWRAP#3359

Open
young0264 wants to merge 2 commits into
OpenFeign:masterfrom
young0264:fix/error-decoder-checked-exception
Open

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

Conversation

@young0264
Copy link
Copy Markdown

@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

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

1 participant