From dca77773c9021f1068c9f2e875da7b694d6b1b54 Mon Sep 17 00:00:00 2001 From: James Thimont Date: Tue, 2 Aug 2016 07:23:10 +0100 Subject: [PATCH] Replace print() + abort() with fatalError() so Quick Testing Framework correctly handles error --- DVR/SessionDataTask.swift | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/DVR/SessionDataTask.swift b/DVR/SessionDataTask.swift index 9e0c32c..5a12d09 100644 --- a/DVR/SessionDataTask.swift +++ b/DVR/SessionDataTask.swift @@ -52,27 +52,23 @@ class SessionDataTask: NSURLSessionDataTask { } if cassette != nil { - print("[DVR] Invalid request. The request was not found in the cassette.") - abort() + fatalError("[DVR] Invalid request. The request was not found in the cassette.") } // Cassette is missing. Record. if session.recordingEnabled == false { - print("[DVR] Recording is disabled.") - abort() + fatalError("[DVR] Recording is disabled.") } let task = session.backingSession.dataTaskWithRequest(request) { [weak self] data, response, error in //Ensure we have a response guard let response = response else { - print("[DVR] Failed to record because the task returned a nil response.") - abort() + fatalError("[DVR] Failed to record because the task returned a nil response.") } guard let this = self else { - print("[DVR] Something has gone horribly wrong.") - abort() + fatalError("[DVR] Something has gone horribly wrong.") } // Still call the completion block so the user can chain requests while recording.