How to programmatically stop a migration? Say I want to stop a migration that I'd like to stop on preImport under similar circumstances as a dependency not being fulfilled, is there a way to do this?

I would like to stop the migration and prevent postImport from running, preferably from preImport().

public function preImport() {
  parent::preImport();
  if($this-&gt;externalDependency == 0){
  // Stop the migration, and maybe even throw an error.
  }
}
According to my comment on Luke solution, here is the complete code to interrupt you Migration in Migrate these days.

public function preImport() {
  parent::preImport();
  if($this-&gt;externalDependency == 0){
  throw new MigrateException('Dependencies were unfulfilled.');
  }
}

public function postImport() {
  parent::postImport();
  if($this-&gt;externalDependency == 0){
  return false;
  }
  // My code here
}

public function processImport(array $options = array()) {
  try {
    $result = parent::processImport($options);
    return $result;
  }
  catch (MigrateException $e) {
    $this-&gt;endProcess();
    drupal_set_message($e-&gt;getMessage(), 'error');
    return MigrationBase::RESULT_STOPPED;
  }
}