Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 4 additions & 8 deletions DVR/SessionDataTask.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down