You are here

function views_oai_pmh_plugin_display::oai_error in Views OAI-PMH 7

Same name and namespace in other branches
  1. 6.2 plugins/views_oai_pmh_plugin_display.inc \views_oai_pmh_plugin_display::oai_error()
  2. 6 plugins/views_oai_pmh_plugin_display.inc \views_oai_pmh_plugin_display::oai_error()
  3. 7.2 plugins/views_oai_pmh_plugin_display.inc \views_oai_pmh_plugin_display::oai_error()
4 calls to views_oai_pmh_plugin_display::oai_error()
views_oai_pmh_plugin_display::get_oai_resumption_token in plugins/views_oai_pmh_plugin_display.inc
views_oai_pmh_plugin_display::oai_check_args in plugins/views_oai_pmh_plugin_display.inc
views_oai_pmh_plugin_display::oai_check_metadata_prefix in plugins/views_oai_pmh_plugin_display.inc
views_oai_pmh_plugin_display::parse_oai_request in plugins/views_oai_pmh_plugin_display.inc

File

plugins/views_oai_pmh_plugin_display.inc, line 366
Contains the OAI-PMH display plugin.

Class

views_oai_pmh_plugin_display
We are based on a feed display for compatibility.

Code

function oai_error($code, $argument = '', $value = '') {
  $this->oai_compression = FALSE;
  $error = array(
    'key' => 'error',
    'attributes' => array(
      'code' => $code,
    ),
  );
  switch ($code) {
    case 'badArgument':
      $error += array(
        'value' => t("The argument @argument (value=@value) included in the request is not valid.", array(
          '@value' => $value,
          '@argument' => $argument,
        )),
      );
      break;
    case 'badGranularity':
      $error = array(
        'key' => 'error',
        'attributes' => array(
          'code' => 'badArgument',
        ),
        'value' => t("The value @value of the argument '@argument' is not valid.", array(
          '@value' => $value,
          '@argument' => $argument,
        )),
      );
      break;
    case 'badResumptionToken':
      $error += array(
        'value' => t("The resumptionToken @value does not exist or has already expired.", array(
          '@value' => $value,
        )),
      );
      break;
    case 'badRequestMethod':
      $error = array(
        'key' => 'error',
        'attributes' => array(
          'code' => 'badVerb',
        ),
        'value' => t("The request method @argument is unknown.", array(
          '@argument' => $argument,
        )),
      );
      break;
    case 'badVerb':
      $error += array(
        'value' => t("The verb @argument provided in the request is illegal.", array(
          '@argument' => $argument,
        )),
      );
      break;
    case 'cannotDisseminateFormat':
      $error += array(
        'value' => t("The metadata format @value given by @argument is not supported by this repository.", array(
          '@value' => $value,
          '@argument' => $argument,
        )),
      );
      break;
    case 'exclusiveArgument':
      $error = array(
        'key' => 'error',
        'attributes' => array(
          'code' => 'badArgument',
        ),
        'value' => t('The usage of resumptionToken as an argument allows no other arguments.'),
      );
      break;
    case 'idDoesNotExist':
      $error += array(
        'value' => t("The value @value of the identifier is illegal for this repository.", array(
          '@value' => $value,
        )),
      );
      break;
    case 'missingArgument':
      $error = array(
        'key' => 'error',
        'attributes' => array(
          'code' => 'badArgument',
        ),
        'value' => t("The required argument @argument is missing in the request.", array(
          '@argument' => $argument,
        )),
      );
      break;
    case 'noRecordsMatch':
      $error += array(
        'value' => t('The combination of the given values results in an empty list.'),
      );
      break;
    case 'noMetadataFormats':
      $error += array(
        'value' => t('There are no metadata formats available for the specified item.'),
      );
      break;
    case 'noVerb':
      $error = array(
        'key' => 'error',
        'attributes' => array(
          'code' => 'badVerb',
        ),
        'value' => t('The request does not provide any verb.'),
      );
      break;
    case 'noSetHierarchy':
      $error += array(
        'value' => t('This repository does not support sets.'),
      );
      break;
    case 'sameArgument':
      $error = array(
        'key' => 'error',
        'attributes' => array(
          'code' => 'badArgument',
        ),
        'value' => t('Do not use them same argument more than once.'),
      );
      break;
    case 'sameVerb':
      $error = array(
        'key' => 'error',
        'attributes' => array(
          'code' => 'badVerb',
        ),
        'value' => t('Do not use verb more than once.'),
      );
      break;
    default:
      $error = array(
        'key' => 'error',
        'attributes' => array(
          'code' => 'badArgument',
        ),
        'value' => t("Unknown error: code: @code, argument: @argument, value: @value", array(
          '@value' => $value,
          '@argument' => $argument,
          '@code' => $code,
        )),
      );
  }
  $this->oai_errors[] = $error;
  $this->oai_args['errors'] = $this->oai_errors;
  return $this->oai_errors;
}