Skip to content

Interceptor callback exceptions can turn successful fetches into rejections #6

Closed

Description

@mktbsh

Summary

The fetch interceptor currently calls matcher and onIntercept directly in the request path. If either callback throws, the original fetch() call rejects even when the network request itself succeeded.

That makes interception logic capable of breaking application behavior.

Current behavior

A successful response can be converted into a rejected fetch() promise when user-supplied interception code throws.

Expected behavior

Interception should be observational by default. Callback failures should not change the success or failure of the original fetch() unless the library explicitly documents that behavior.

Impact

  • Logging or analytics code can break production requests
  • Consumers have to wrap every callback defensively to avoid changing network semantics
  • The library is not transparently safe to enable around existing code

Suggested acceptance criteria

  • Exceptions thrown by matcher or onIntercept do not reject a successful fetch() call
  • Failure handling behavior is documented
  • Tests cover callback exceptions for both matcher and interception callbacks

Activity

  1. self-assigned this
    on Mar 14, 2026
  2. linked a pull request that will close this issue#6 safe callback errors #7on Mar 14, 2026
  3. added a commit that references this issue on Mar 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions