5af0dc568156b3dad3f7b01f165e285916204902
[m6w6/ext-http] / http_exception_object.c
1 /*
2 +----------------------------------------------------------------------+
3 | PECL :: http |
4 +----------------------------------------------------------------------+
5 | This source file is subject to version 3.0 of the PHP license, that |
6 | is bundled with this package in the file LICENSE, and is available |
7 | through the world-wide-web at http://www.php.net/license/3_0.txt. |
8 | If you did not receive a copy of the PHP license and are unable to |
9 | obtain it through the world-wide-web, please send a note to |
10 | license@php.net so we can mail you a copy immediately. |
11 +----------------------------------------------------------------------+
12 | Copyright (c) 2004-2005 Michael Wallner <mike@php.net> |
13 +----------------------------------------------------------------------+
14 */
15
16 /* $Id$ */
17
18
19 #ifdef HAVE_CONFIG_H
20 # include "config.h"
21 #endif
22
23 #include "php.h"
24
25 #include "php_http.h"
26 #include "php_http_std_defs.h"
27
28 #ifdef ZEND_ENGINE_2
29
30 #include "php_http_exception_object.h"
31 #include "zend_exceptions.h"
32
33 zend_class_entry *http_exception_object_ce;
34 zend_function_entry http_exception_object_fe[] = {
35 {NULL, NULL, NULL}
36 };
37
38 void _http_exception_object_init(INIT_FUNC_ARGS)
39 {
40 HTTP_REGISTER_CLASS(HttpException, http_exception_object, zend_exception_get_default(), 0);
41 }
42
43 zend_class_entry *_http_exception_get_default()
44 {
45 return http_exception_object_ce;
46 }
47
48 void _http_exception_throw_ce_ex(zend_class_entry *ce, int code TSRMLS_DC)
49 {
50 static char * const errors[] = {
51 "Unkown Error"
52 };
53
54 if (!ce) {
55 ce = http_exception_get_default();
56 }
57
58 zend_throw_exception(ce, errors[code], code TSRMLS_CC);
59 }
60
61 #endif
62
63 /*
64 * Local variables:
65 * tab-width: 4
66 * c-basic-offset: 4
67 * End:
68 * vim600: noet sw=4 ts=4 fdm=marker
69 * vim<600: noet sw=4 ts=4
70 */
71