             return reason.responseCode
         default:
             return 0
+        }
+    }
+    
+    /// The `Error` returned by a system framework associated with a `.responseValidationFailed`
+    public var underlyingError: Error? {
+        switch self {
+        case .responseValidationFailed(let reason):
+            return reason.underlyingError
+        default:
+            return nil
         }
     }
     

    ///
    /// - tokenExpired: request received a 401 from a backend
    /// - badRequest: generic error for responses
    /// - unknownReason: a request that could not validate a status code
    public enum ResponseFailureReason {
        
        case tokenExpired(code: Int)
        case badRequest(code: Int)
        case internalServerError
        case badStatusCode
        case persistanceFailure(code: Int)

            self = .internalServerError
            
        default:
            self = .badRequest(error: error)
        }
    }
}
