0
|
1 <?php
|
|
2
|
|
3 /**
|
|
4 +-------------------------------------------------------------------------+
|
|
5 | Error class for the Enigma Plugin |
|
|
6 | |
|
|
7 | Copyright (C) 2010-2015 The Roundcube Dev Team |
|
|
8 | |
|
|
9 | Licensed under the GNU General Public License version 3 or |
|
|
10 | any later version with exceptions for skins & plugins. |
|
|
11 | See the README file for a full license statement. |
|
|
12 | |
|
|
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
|
|
25 const OK = 0;
|
|
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;
|
|
33
|
|
34
|
|
35 function __construct($code = null, $message = '', $data = array())
|
|
36 {
|
|
37 $this->code = $code;
|
|
38 $this->message = $message;
|
|
39 $this->data = $data;
|
|
40 }
|
|
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 {
|
|
54 return $name ? $this->data[$name] : $this->data;
|
|
55 }
|
|
56 }
|