commit | author | age
|
48e9c1
|
1 |
<?php |
T |
2 |
/* |
|
3 |
+-------------------------------------------------------------------------+ |
|
4 |
| Error class for the Enigma Plugin | |
|
5 |
| | |
|
6 |
| This program is free software; you can redistribute it and/or modify | |
|
7 |
| it under the terms of the GNU General Public License version 2 | |
|
8 |
| as published by the Free Software Foundation. | |
|
9 |
| | |
|
10 |
| This program is distributed in the hope that it will be useful, | |
|
11 |
| but WITHOUT ANY WARRANTY; without even the implied warranty of | |
|
12 |
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
|
13 |
| GNU General Public License for more details. | |
|
14 |
| | |
|
15 |
| You should have received a copy of the GNU General Public License along | |
|
16 |
| with this program; if not, write to the Free Software Foundation, Inc., | |
|
17 |
| 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. | |
|
18 |
| | |
|
19 |
+-------------------------------------------------------------------------+ |
|
20 |
| Author: Aleksander Machniak <alec@alec.pl> | |
|
21 |
+-------------------------------------------------------------------------+ |
|
22 |
*/ |
|
23 |
|
|
24 |
class enigma_error |
|
25 |
{ |
|
26 |
private $code; |
|
27 |
private $message; |
|
28 |
private $data = array(); |
|
29 |
|
|
30 |
// error codes |
|
31 |
const E_OK = 0; |
|
32 |
const E_INTERNAL = 1; |
|
33 |
const E_NODATA = 2; |
|
34 |
const E_KEYNOTFOUND = 3; |
|
35 |
const E_DELKEY = 4; |
|
36 |
const E_BADPASS = 5; |
|
37 |
|
|
38 |
function __construct($code = null, $message = '', $data = array()) |
|
39 |
{ |
|
40 |
$this->code = $code; |
|
41 |
$this->message = $message; |
|
42 |
$this->data = $data; |
|
43 |
} |
|
44 |
|
|
45 |
function getCode() |
|
46 |
{ |
|
47 |
return $this->code; |
|
48 |
} |
|
49 |
|
|
50 |
function getMessage() |
|
51 |
{ |
|
52 |
return $this->message; |
|
53 |
} |
|
54 |
|
|
55 |
function getData($name) |
|
56 |
{ |
|
57 |
if ($name) |
|
58 |
return $this->data[$name]; |
|
59 |
else |
|
60 |
return $this->data; |
|
61 |
} |
|
62 |
} |