Skip to content

WpNetworkResponse.init uses preconditionFailure where the throwing error path already exists #1515

Description

@jkmassel

Split out from #1497Swift executor URLSession error audit. Section D — Crash instead of classified error.

File references are to native/swift/Sources/wordpress-api/SafeRequestExecutor.swift unless noted; :NNN line numbers were verified against fix/converge-executor-error-classification.

Severity: low. guard let response = response as? HTTPURLResponse else { preconditionFailure(...) } (Extensions.swift:17). The initializer is already throws and is called inside perform()'s do-block, so throw URLError(.badServerResponse) degrades gracefully to .genericError today. Verified effectively unreachable for http(s) loads on Darwin and Linux — defense-in-depth, retained because the fix is one line. (The same verification cleared the completion-handler data!/response! force-unwraps on both platforms: no finding there.)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions