protected static function getErrorData()

in templates/php/src/FacebookAds/Http/Exception/RequestException.php [130:159]


  protected static function getErrorData(ResponseInterface $response) {
    $response_data = $response->getContent();
    if (is_null($response_data)) {
      $response_data = array();
    }
    $error_data = static::idx($response_data, 'error', array());

    if (is_string(static::idx($error_data, 'error_data'))) {
      $error_data["error_data"] =
        json_decode(stripslashes(static::idx($error_data, 'error_data')), true);
    }

    if (is_null(static::idx($error_data, 'error_data'))) {
      $error_data["error_data"] = array();
    }

    return array(
      'code' =>
        static::idx($error_data, 'code', static::idx($response_data, 'code')),
      'error_subcode' => static::idx($error_data, 'error_subcode'),
      'message' => static::idx($error_data, 'message'),
      'error_user_title' => static::idx($error_data, 'error_user_title'),
      'error_user_msg' => static::idx($error_data, 'error_user_msg'),
      'error_blame_field_specs' =>
        static::idx(static::idx($error_data, 'error_data', array()),
          'blame_field_specs'),
      'fbtrace_id' => static::idx($error_data, 'fbtrace_id'),
      'type' => static::idx($error_data, 'type'),
    );
  }