You are here

public function FeedImportProcessor::errorHandler in Feed Import 8

Error handler callback This is setted with set_error_handling()

File

feed_import_base/src/FeedImportProcessor.php, line 146

Class

FeedImportProcessor
Class that processess the import.

Namespace

Drupal\feed_import_base

Code

public function errorHandler($errno, $errmsg, $file, $line) {

  // Handle silenced errors with @.
  if (error_reporting() == 0) {
    return FALSE;
  }

  // Add error to reports.
  if ($this->errorsLeft) {
    $this->report['errors'][] = array(
      'error' => $errmsg,
      'error number' => $errno,
      'line' => $line,
      'file' => $file,
    );
    $this->errorsLeft--;
  }

  // Throw an exception to be caught by a try-catch statement.
  if ($this->throwException) {
    throw new \Exception("(Uncaught Feed Import Exception) [{$errmsg}; file: {$file}; line: {$line}]", $errno);
  }
}