You are here

protected function JmesPathParser::getErrors in Feeds extensible parsers 8

Returns the errors after parsing.

Return value

array A structured array array with keys:

  • message: The error message.
  • variables: The variables for the message.
  • severity: The severity of the message.

Overrides ParserBase::getErrors

See also

watchdog()

File

src/Feeds/Parser/JmesPathParser.php, line 215

Class

JmesPathParser
Defines a JSON parser using JMESPath.

Namespace

Drupal\feeds_ex\Feeds\Parser

Code

protected function getErrors() {
  if (!function_exists('json_last_error')) {
    return [];
  }
  if (!($error = json_last_error())) {
    return [];
  }
  $message = [
    'message' => $this->utility
      ->translateError($error),
    'variables' => [],
    'severity' => RfcLogLevel::ERROR,
  ];
  return [
    $message,
  ];
}