commit | author | age
|
48e9c1
|
1 |
<?php |
58c279
|
2 |
|
AM |
3 |
/** |
48e9c1
|
4 |
+-------------------------------------------------------------------------+ |
T |
5 |
| Error class for the Enigma Plugin | |
|
6 |
| | |
a99c34
|
7 |
| Copyright (C) 2010-2015 The Roundcube Dev Team | |
48e9c1
|
8 |
| | |
a99c34
|
9 |
| Licensed under the GNU General Public License version 3 or | |
AM |
10 |
| any later version with exceptions for skins & plugins. | |
|
11 |
| See the README file for a full license statement. | |
48e9c1
|
12 |
| | |
T |
13 |
+-------------------------------------------------------------------------+ |
|
14 |
| Author: Aleksander Machniak <alec@alec.pl> | |
|
15 |
+-------------------------------------------------------------------------+ |
|
16 |
*/ |
|
17 |
|
|
18 |
class enigma_error |
|
19 |
{ |
|
20 |
private $code; |
|
21 |
private $message; |
|
22 |
private $data = array(); |
|
23 |
|
|
24 |
// error codes |
cffe97
|
25 |
const OK = 0; |
AM |
26 |
const INTERNAL = 1; |
|
27 |
const NODATA = 2; |
|
28 |
const KEYNOTFOUND = 3; |
|
29 |
const DELKEY = 4; |
|
30 |
const BADPASS = 5; |
|
31 |
const EXPIRED = 6; |
|
32 |
const UNVERIFIED = 7; |
3e98f8
|
33 |
|
0878c8
|
34 |
|
48e9c1
|
35 |
function __construct($code = null, $message = '', $data = array()) |
T |
36 |
{ |
0878c8
|
37 |
$this->code = $code; |
48e9c1
|
38 |
$this->message = $message; |
0878c8
|
39 |
$this->data = $data; |
48e9c1
|
40 |
} |
T |
41 |
|
|
42 |
function getCode() |
|
43 |
{ |
|
44 |
return $this->code; |
|
45 |
} |
|
46 |
|
|
47 |
function getMessage() |
|
48 |
{ |
|
49 |
return $this->message; |
|
50 |
} |
|
51 |
|
|
52 |
function getData($name) |
|
53 |
{ |
9f1f75
|
54 |
return $name ? $this->data[$name] : $this->data; |
48e9c1
|
55 |
} |
T |
56 |
} |