Skip to content

🐛 Allow callFollowingErrorInterceptor when rejecting in ErrorInterceptorHandler#2543

Merged
AlexV525 merged 3 commits into
mainfrom
alexv525-fix-queued-interceptor-reject
Jun 29, 2026
Merged

🐛 Allow callFollowingErrorInterceptor when rejecting in ErrorInterceptorHandler#2543
AlexV525 merged 3 commits into
mainfrom
alexv525-fix-queued-interceptor-reject

Conversation

@AlexV525

Copy link
Copy Markdown
Member

Fixes #2462

RequestInterceptorHandler and ResponseInterceptorHandler both expose a callFollowingErrorInterceptor flag in their reject() methods, but ErrorInterceptorHandler.reject() was missing it — it always emits InterceptorResultType.reject, unconditionally skipping any subsequent error interceptors.

The errorInterceptorWrapper in dio_mixin.dart already handles rejectCallFollowing correctly, so only the handler method needed updating.

RequestInterceptorHandler and ResponseInterceptorHandler both support
the callFollowingErrorInterceptor flag in their reject() methods, but
ErrorInterceptorHandler.reject() was missing it, always emitting
InterceptorResultType.reject and causing subsequent error interceptors
to be skipped unconditionally.

The errorInterceptorWrapper in dio_mixin.dart already handles
rejectCallFollowing correctly, so only the handler method needed fixing.

Fixes #2462

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@AlexV525 AlexV525 requested a review from a team as a code owner June 27, 2026 02:14
AlexV525 and others added 2 commits June 27, 2026 10:39
Add a regression test to ensure calling ErrorInterceptorHandler.reject(error, true)
inside QueuedInterceptorsWrapper continues to following error interceptors.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@github-actions

Copy link
Copy Markdown
Contributor

Code Coverage Report: Only Changed Files listed

Package Base Coverage New Coverage Difference
Overall Coverage 🟢 85.54% 🟢 85.54% ⚪ 0%

Minimum allowed coverage is 0%, this run produced 85.54%

@CaiJingLong

Copy link
Copy Markdown
Contributor

PR Review: Allow callFollowingErrorInterceptor in ErrorInterceptorHandler.reject

Risk: LOW

Changes Summary

Core Verdict

The fix is correct and minimal. ErrorInterceptorHandler.reject was the only one of the three handlers missing the callFollowingErrorInterceptor parameter — both RequestInterceptorHandler.reject and ResponseInterceptorHandler.reject already support it.

The PR description's claim that errorInterceptorWrapper already handles rejectCallFollowing correctly is accurate: in dio_mixin.dart, InterceptorResultType.rejectCallFollowing shares the same branch as next, continuing to subsequent error interceptors. So only the handler method needed updating.

Verification

  • dart analyze lib/src/interceptor.dart: no issues
  • New test QueuedInterceptor error interceptor reject with callFollowingErrorInterceptor continues: passes
  • Full interceptor_test.dart suite (33 tests): all pass
  • stacktrace_test.dart: 1 failure (SocketException on request — HandshakeException), confirmed to also fail on main, unrelated to this PR

Findings

  1. [suggestion] Test coverage could extend to the non-queued case
    The fix is on the base ErrorInterceptorHandler, so it applies to both InterceptorsWrapper and QueuedInterceptorsWrapper (dio_mixin.dart wraps both via errorInterceptorWrapper). The PR only adds a regression test for QueuedInterceptorsWrapper. A symmetric case for the non-queued InterceptorsWrapper is not strictly required but would make coverage more robust.

  2. [ok] Doc comment
    The new dartdoc matches the existing reject doc on the other two handlers exactly. The API shape (optional positional param, default false) is aligned and backwards-compatible.

  3. [ok] CHANGELOG
    Entry style matches surrounding entries, placed under the Unreleased section.

Recommendation

APPROVE. The fix is precise, minimal, backwards-compatible, and includes a regression test. Optional improvement: add a symmetric test for the non-queued InterceptorsWrapper case.

@AlexV525 AlexV525 merged commit 82a142c into main Jun 29, 2026
5 checks passed
@AlexV525 AlexV525 deleted the alexv525-fix-queued-interceptor-reject branch June 29, 2026 04:08
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.

QueuedInterceptors strange behavior

2 participants