From 2c28d0b86bc8fde2e4b9f5a954e803c579f698a0 Mon Sep 17 00:00:00 2001 From: Mauricio Chirino <1657723+mchirino89@users.noreply.github.com> Date: Mon, 27 Jul 2026 00:27:01 -0300 Subject: [PATCH] feat: add NetworkError.gone for HTTP 410 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The resource existed and is permanently gone — distinct from 404, and exactly what an expired challenge link maps to. Without it buildError(from: 410) degraded to .unknown. Co-Authored-By: Claude Fable 5 Claude-Session: https://claude.ai/code/session_01Cz7KThgfTBVH8Y3wUju6GX --- Sources/MauriNet/Global/NetworkError.swift | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Sources/MauriNet/Global/NetworkError.swift b/Sources/MauriNet/Global/NetworkError.swift index b85d09c..a50635d 100644 --- a/Sources/MauriNet/Global/NetworkError.swift +++ b/Sources/MauriNet/Global/NetworkError.swift @@ -46,6 +46,11 @@ public enum NetworkError: Int, Error, CaseIterable, Sendable { /// Conflicts are most likely to occur in response to a PUT request. For example, you may get a 409 response when uploading a file which is older than the one already on the server resulting in a version control conflict. Source: [MDN Web Docs](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/409) case conflictOnResource = 409 + /// Indicates that the target resource is no longer available and this condition is likely to be permanent. + /// + /// Unlike 404, it signals the resource existed and was intentionally removed — clients should not retry. Source: [MDN Web Docs](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/410) + case gone = 410 + /// Indicates that access to the target reSource has been denied. /// /// This happens with conditional requests on methods other than GET or HEAD when the condition defined by the If-Unmodified-Since or If-None-Match headers is not fulfilled. In that case, the request, usually an upload or a modification of a reSource, cannot be made and this error response is sent back. Source: [MDN Web Docs](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/412) @@ -106,6 +111,8 @@ public enum NetworkError: Int, Error, CaseIterable, Sendable { return "Request was cancelled" case .conflictOnResource: return "There's an internal conflict with the requested reSource" + case .gone: + return "The requested reSource is permanently gone" case .preconditionFailed: return "Precondition failed for this request" case .serviceUnavailable: