Swift 2 Error Handling

This is the way I altered the code for saving/loading using error handling in Swift 2. Not sure if it’s correct, but it complies with no errors.

[code] // MARK: -Saving file

override func dataOfType(typeName: String) throws -> NSData {
    
    // End editing
    tableView.window?.endEditingFor(nil)
   
    guard let archive: NSData = NSKeyedArchiver.archivedDataWithRootObject(employees)
        else {
            let outError: NSError! = NSError(domain: "Migrator", code: 0, userInfo: [NSLocalizedDescriptionKey : "The file could not be written."])
            throw outError
    }
    
    return archive
  
}

// MARK: -Loading file

override func readFromData(data: NSData, ofType typeName: String) throws {
    
    print("About to read data of type \(typeName)")
    
    guard let archive = NSKeyedUnarchiver.unarchiveObjectWithData(data) as! [Employee]?
        else {
             let outError: NSError! = NSError(domain: "Migrator", code: 0, userInfo: [NSLocalizedDescriptionKey : "The file could not be read."])
            throw outError
    }
   
    employees = archive
   
}[/code]