1 <?php
2 /*
3 Copyright (c) 2012, University of Cambridge Computing Service
4
5 This file is part of the Lookup/Ibis client library.
6
7 This library is free software: you can redistribute it and/or modify
8 it under the terms of the GNU Lesser General Public License as published
9 by the Free Software Foundation, either version 3 of the License, or
10 (at your option) any later version.
11
12 This library is distributed in the hope that it will be useful, but
13 WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
14 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
15 License for more details.
16
17 You should have received a copy of the GNU Lesser General Public License
18 along with this library. If not, see <http://www.gnu.org/licenses/>.
19 */
20
21 /**
22 * Exception thrown when a web service API method fails. This is wrapper
23 * around the {@link IbisError} object returned by the server, which contains
24 * the full details of what went wrong.
25 *
26 * @author Dean Rasheed (dev-group@ucs.cam.ac.uk)
27 */
28 class IbisException extends Exception
29 {
30 private $ibisError;
31
32 /**
33 * Construct a new IbisException wrapping the specified IbisError.
34 *
35 * @param IbisError $ibisError The error from the server.
36 */
37 public function __construct($ibisError)
38 {
39 parent::__construct($ibisError->message);
40 $this->ibisError = $ibisError;
41 }
42
43 /**
44 * Returns the underlying error from the server.
45 *
46 * @return IbisError The underlying error from the server.
47 */
48 public function getError()
49 {
50 return $this->ibisError;
51 }
52 }
53