 
  - parameter model: The `CoreDataModel` instance on which to perform a migration.
 
- - throws: If an error occurs, a `MigrationError` is thrown.
- - seealso: `MigrationError`
+ - throws: If an error occurs, either an `NSError` or a `MigrationError` is thrown. If an `NSError` is thrown, it could 
+ specify any of the following: an error checking persistent store metadata, an error from `NSMigrationManager`, or
+ an error from `NSFileManager`.
 
  - warning: Migration is only supported for on-disk persistent stores.
  A complete 'path' of mapping models must exist between the peristent store's version and the model's version.

                                                        destinationModel: model.managedObjectModel)

    for step in migrationSteps {
        let tempURL = defaultDirectoryURL().URLByAppendingPathComponent("migration.sqlite")

        let manager = NSMigrationManager(sourceModel: step.source, destinationModel: step.destination)
        try manager.migrateStoreFromURL(storeURL, type: storeType, options: nil, withMappingModel: step.mapping, toDestinationURL: tempURL, destinationType: storeType, destinationOptions: nil)

        try model.removeExistingStore()
        try NSFileManager.defaultManager().moveItemAtURL(tempURL, toURL: storeURL)
    }

public func migrate(model: CoreDataModel) throws {
    guard model.needsMigration else { return }

    guard let storeURL = model.storeURL, let storeDirectory = model.storeType.storeDirectory() else {
        preconditionFailure("*** Error: migration is only available for on-disk persistent stores. Received invalid model: \(model)")
    }

    let bundle = model.bundle
    let storeType = model.storeType.type

    // could also throw NSError from NSPersistentStoreCoordinator
    guard let sourceModel = try findCompatibleModel(withBundle: bundle, storeType: storeType, storeURL: storeURL) else {
        throw MigrationError.SourceModelNotFound(model: model)
    }
