Skip to content

Refactor error handling in Request class to simplify error reporting#454

Open
jcarroll3 wants to merge 1 commit intodropbox:masterfrom
jcarroll3:fix_uncessary_error_wrapping
Open

Refactor error handling in Request class to simplify error reporting#454
jcarroll3 wants to merge 1 commit intodropbox:masterfrom
jcarroll3:fix_uncessary_error_wrapping

Conversation

@jcarroll3
Copy link

NetworkTaskFailure.failedWithError already carries a ClientError value (defined at NetworkTask.swift:40). The old code passed this through .urlSessionError(error), which wraps the ClientError inside another ClientError.urlSessionError case. This means consumers matching on the error (e.g., .clientError(.fileAccessError(...))) would never match, the actual error was hidden behind an extra .urlSessionError layer.

This change passes the ClientError directly to CallError(clientError:), preserving the original error kind (e.g., .urlSessionError, .fileAccessError, .requestObjectDeallocated) so callers can match on it correctly.

This is a bug. Error handling code downstream that pattern-matches on specific ClientError cases will silently fail to match today because every failure-path error is uniformly reported as .urlSessionError regardless of its actual type.

@CLAassistant
Copy link

CLAassistant commented Feb 24, 2026

CLA assistant check
All committers have signed the CLA.

@jcarroll3 jcarroll3 force-pushed the fix_uncessary_error_wrapping branch from b27799f to 96c1b1f Compare February 24, 2026 22:02
@jcarroll3 jcarroll3 force-pushed the fix_uncessary_error_wrapping branch from 96c1b1f to 08f9500 Compare February 25, 2026 19:30
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.

2 participants