simple-oai-pmh/Classes/Exception.php

63 lines
2.6 KiB
PHP
Raw Normal View History

<?php
2017-05-12 18:12:49 +02:00
/**
* Simple OAI-PMH 2.0 Data Provider
* Copyright (C) 2005 Heinrich Stamerjohanns <stamer@uni-oldenburg.de>
* Copyright (C) 2011 Jianfeng Li <jianfeng.li@adelaide.edu.au>
2017-05-12 18:12:49 +02:00
* Copyright (C) 2013 Daniel Neis Araujo <danielneis@gmail.com>
* Copyright (C) 2017 Sebastian Meyer <sebastian.meyer@opencultureconsulting.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
2020-01-24 00:13:17 +01:00
namespace OCC\OAI2;
class Exception extends \Exception {
2017-05-12 18:12:49 +02:00
public function __construct($code) {
2020-01-08 17:24:22 +01:00
$this->errorTable = [
'badArgument' => [
2017-05-12 18:12:49 +02:00
'text' => 'The request includes illegal arguments, is missing required arguments, includes a repeated argument, or values for arguments have an illegal syntax.',
2020-01-08 17:24:22 +01:00
],
'badResumptionToken' => [
2017-05-12 18:12:49 +02:00
'text' => 'The value of the resumptionToken argument is invalid or expired.',
2020-01-08 17:24:22 +01:00
],
'badVerb' => [
2017-05-12 18:12:49 +02:00
'text' => 'Value of the verb argument is not a legal OAI-PMH verb, the verb argument is missing, or the verb argument is repeated.',
2020-01-08 17:24:22 +01:00
],
'cannotDisseminateFormat' => [
2017-05-12 18:12:49 +02:00
'text' => 'The metadata format identified by the value given for the metadataPrefix argument is not supported by the item or by the repository.',
2020-01-08 17:24:22 +01:00
],
'idDoesNotExist' => [
2017-05-12 18:12:49 +02:00
'text' => 'The value of the identifier argument is unknown or illegal in this repository.',
2020-01-08 17:24:22 +01:00
],
'noRecordsMatch' => [
'text' => 'The combination of the values of the from, until, set and metadataPrefix arguments results in an empty list.',
2020-01-08 17:24:22 +01:00
],
'noMetadataFormats' => [
'text' => 'There are no metadata formats available for the specified item.',
2020-01-08 17:24:22 +01:00
],
'noSetHierarchy' => [
'text' => 'The repository does not support sets.',
2020-01-08 17:24:22 +01:00
],
];
2013-05-14 21:46:15 +02:00
parent::__construct($this->errorTable[$code]['text']);
$this->code = $code;
}
public function getOAI2Code() {
return $this->code;
}
2017-05-12 18:12:49 +02:00
}