1: <?php
2: /**
3: * Exception handler for the Horde_Imap_Client package.
4: *
5: * Additional server debug information MAY be found in the $details
6: * property.
7: *
8: * Copyright 2008-2012 Horde LLC (http://www.horde.org/)
9: *
10: * See the enclosed file COPYING for license information (LGPL). If you
11: * did not receive this file, see http://www.horde.org/licenses/lgpl21.
12: *
13: * @author Michael Slusarz <slusarz@horde.org>
14: * @category Horde
15: * @license http://www.horde.org/licenses/lgpl21 LGPL 2.1
16: * @package Imap_Client
17: */
18: class Horde_Imap_Client_Exception extends Horde_Exception_Wrapped
19: {
20: /* Error message codes. */
21:
22: // Unspecified error (default)
23: const UNSPECIFIED = 0;
24:
25: // There was an unrecoverable error in UTF7IMAP -> UTF8 conversion.
26: const UTF7IMAP_CONVERSION = 3;
27:
28: // The server ended the connection.
29: const DISCONNECT = 4;
30:
31: // The charset used in the search query is not supported on the server.
32: const BADCHARSET = 5;
33:
34: // There were errors parsing the MIME/RFC 2822 header of the part.
35: const PARSEERROR = 6;
36:
37: // The server could not decode the MIME part (see RFC 3516)
38: const UNKNOWNCTE = 7;
39:
40: // The comparator specified by setComparator() was not recognized by the
41: // IMAP server
42: const BADCOMPARATOR = 9;
43:
44: // RFC 4551 [3.1.2] - All mailboxes are not required to support
45: // mod-sequences.
46: const MBOXNOMODSEQ = 10;
47:
48: // Thrown if server denies the network connection.
49: const SERVER_CONNECT = 11;
50:
51: // Thrown if read error for server response.
52: const SERVER_READERROR = 12;
53:
54: // Thrown on CATENATE if the message was too big.
55: const CATENATE_TOOBIG = 14;
56:
57: // Thrown on CREATE if special-use attribute is not supported.
58: const USEATTR = 15;
59:
60: // The user did not have permissions to carry out the operation.
61: const NOPERM = 17;
62:
63: // The operation was not successful because another user is holding
64: // a necessary resource. The operation may succeed if attempted later.
65: const INUSE = 18;
66:
67: // The operation failed because data on the server was corrupt.
68: const CORRUPTION = 19;
69:
70: // The operation failed because it exceeded some limit on the server.
71: const LIMIT = 20;
72:
73: // The operation failed because the user is over their quota.
74: const OVERQUOTA = 21;
75:
76: // The operation failed because the requested creation object already
77: // exists.
78: const ALREADYEXISTS = 22;
79:
80: // The operation failed because the requested deletion object did not
81: // exist.
82: const NONEXISTENT = 23;
83:
84: // Setting metadata failed because the size of its value is too large.
85: // The maximum octet count the server is willing to accept will be
86: // in the exception message string.
87: const METADATA_MAXSIZE = 24;
88:
89: // Setting metadata failed because the maximum number of allowed
90: // annotations has already been reached.
91: const METADATA_TOOMANY = 25;
92:
93: // Setting metadata failed because the server does not support private
94: // annotations on one of the specified mailboxes.
95: const METADATA_NOPRIVATE = 26;
96:
97: // Invalid metadata entry.
98: const METADATA_INVALID = 27;
99:
100:
101: // Login failures
102:
103: // Could not start mandatory TLS connection.
104: const LOGIN_TLSFAILURE = 100;
105:
106: // Could not find an available authentication method.
107: const LOGIN_NOAUTHMETHOD = 101;
108:
109: // Generic authentication failure.
110: const LOGIN_AUTHENTICATIONFAILED = 102;
111:
112: // Remote server is unavailable.
113: const LOGIN_UNAVAILABLE = 103;
114:
115: // Authentication succeeded, but authorization failed.
116: const LOGIN_AUTHORIZATIONFAILED = 104;
117:
118: // Authentication is no longer permitted with this passphrase.
119: const LOGIN_EXPIRED = 105;
120:
121: // Login requires privacy.
122: const LOGIN_PRIVACYREQUIRED = 106;
123:
124:
125: // Mailbox access failures
126:
127: // Could not open/access mailbox
128: const MAILBOX_NOOPEN = 200;
129:
130:
131: // POP3 specific error codes
132:
133: // Temporary issue. Generally, there is no need to alarm the user for
134: // errors of this type.
135: const POP3_TEMP_ERROR = 300;
136:
137: // Permanent error indicated by server.
138: const POP3_PERM_ERROR = 301;
139:
140:
141: // Unsupported feature error codes
142:
143: // Function/feature is not supported on this server.
144: const NOT_SUPPORTED = 400;
145:
146:
147: // Deprecated
148: const DRIVER_NOT_FOUND = 1;
149: const POP3_NOTSUPPORTED = 2;
150: const NOSUPPORTIMAPEXT = 8;
151: const CATENATE_BADURL = 13;
152: const BADSEARCH = 16;
153:
154:
155: /**
156: * Allow the error code to be altered.
157: *
158: * @param integer $code Error code.
159: */
160: public function setCode($code)
161: {
162: $this->code = intval($code);
163: }
164:
165: }
166: