Added BetterCodes Repository to README.
[phpwikibot.git] / exception.inc
blob317ffe21a719a58cd903dc96483d7400db22fed4
1 <?php
2 /**
3  * PHPwikiBot Exceptions
4  * @author Xiaomao
5  * @package Exception
6  * @name Exception Definitions
7  * @license http://www.gnu.org/licenses/gpl.html GPLv3+
8  */
11 /**
12  * BotException returns has additional function getException() which returns the exception in HTTP header style
13  * e.g. 100 Can't Login. Also include some errors:
14  * + 10 Unexist Method
15  * + 11 Purge Failure
16  * + 12 Usage Error
17  * @package Exception
18  */
19 class BotException extends Exception {
20         
21         /**
22          * getException method returns the exception in HTTP header style
23          * @return string An HTTP header style error code
24          */
25         final public function getException() {
26                 return $this->code.' '.$this->message;
27         }
29 /**
30  * The exception Login Failure (1xx)
31  * 
32  * Error Codes:
33  * + 100 Can't Login
34  * 
35  * @package Exception
36  */
37 class LoginFailure extends BotException {}
39 /**
40  * The exception Get Page Failure (2xx)
41  * 
42  * Error Codes:
43  * + 200 Can't Fetch Page
44  * + 201 Page doesn't exist
45  * + 202 Page title invaild
46  * + 203 Special Page
47  * 
48  * @package Exception
49  */
50 class GetPageFailure extends BotException {}
52 /**
53  * The exception Get Information Failure (3xx)
54  * 
55  * Error Codes:
56  * + 300 Can't Get Info
57  * + 301 Not in Gereral Info
58  *
59  * @package Exception
60  */
61 class InfoFailure extends BotException {}
64 /**
65  * The exception Edit Failure (4xx)
66  * 
67  * Error Codes:
68  * + 400 Edit Failure
69  * + 401 Same Content
70  * + 402 Blank Content
71  * + 403 Forbidden
72  * + 404 Blocked
73  * + 405 Protected
74  * + 406 MD5 Failed
75  * + 420 Page Exists
76  * + 421 Page Doesn't Exist
77  *
78  * @package Exception
79  */
80 class EditFailure extends BotException {}
82 /**
83  * The exception Move Failure (5xx)
84  * 
85  * Error Codes:
86  * + 500 Move Failure
87  * + 501 Destination Exists
88  * + 502 Protected
89  * + 503 Forbidden
90  * + 504 Extension Mismatch
91  * + 505 Wrong Namespace
92  * + 506 Self Move
93  * + 507 Invaild Title
94  *
95  * @package Exception
96  */
97 class MoveFailure extends BotException {}
99 /**
100  * The exception Delete Failure (6xx)
101  * 
102  * Error Codes:
103  * + 600 Delete Failure
104  * + 601 No Such Page
105  * + 602 Blocked
106  * + 603 Forbidden
107  * + 604 Invaild Title
109  * @package Exception
110  */
111 class DeleteFailure extends BotException {}
114  * The exception Protect Failure (7xx)
115  * 
116  * Error Codes:
117  * + 700 Protect Failure
118  * + 701 No Such Page
119  * + 702 Blocked
120  * + 703 Forbidden
121  * + 704 Invaild Title
122  * + 705 Invaild Expiry
123  * + 706 Past Expiry
124  * + 707 Invaild Level
125  * + 708 Page Exists
127  * @package Exception
128  */
129 class ProtectFailure extends BotException {}
132  * The exception Upload Failure (8xx)
133  * 
134  * Error Codes:
135  * + 800 Upload Failure
136  * + 801 Can't Fetch File
137  * + 802 Can't Read File
138  * + 803 Forbidden
139  * + 804 Blocked
141  * @package Exception
142  */
143 class UploadFailure extends BotException {}
146  * The exception Delete Failure (9xx)
147  * 
148  * Error Codes:
149  * + 900 Undelete Failure
150  * + 901 Not Deleted
151  * + 902 Blocked
152  * + 903 Forbidden
153  * + 904 Invaild Title
155  * @package Exception
156  */
157 class UndeleteFailure extends BotException {}
160  * The exception Block Failure (10xx)
161  * 
162  * Error Codes:
163  * + 1000 Block Failure
164  * + 1001 Already Blocked
165  * + 1002 Blocked
166  * + 1003 Forbidden
167  * + 1004 Invaild Expiry
168  * + 1005 Invaild User/IP
169  * + 1006 Unblock Failure
170  * + 1007 Not Blocked
172  * @package Exception
173  */
174 class BlockFailure extends BotException {}
177  * The exception Email Failure (11xx)
178  * 
179  * Error Codes:
180  * + 1100 Email Failure
181  * + 1101 Don't want email
182  * + 1102 Blocked
183  * + 1103 Forbidden
185  * @package Exception
186  */
187 class EmailFailure extends BotException {}
190  * The exception Import Failure (12xx)
191  * 
192  * Error Codes:
193  * + 1200 Import Failure
194  * + 1201 Wrong Interwiki
195  * + 1202 Upload Failure
196  * + 1203 Forbidden
197  * + 1204 Bad File
198  * + 1205 Server Fault
200  * @package Exception
201  */
202 class ImportFailure extends BotException {}
204 //class LoginFailure extends BotException {}*/