Debug continues ;)
[phpCairo.git] / individual_files / phpCairoException.c
blob1b74ad45b93076b22a8df1bc5bdc5f2e182369ba
1 /* {{{ Class CairoException */
3 static zend_class_entry * CairoException_ce_ptr = NULL;
5 /* {{{ Methods */
7 static zend_function_entry CairoException_methods[] = {
8 { NULL, NULL, NULL }
9 };
11 /* }}} Methods */
13 static void class_init_CairoException(void)
15 zend_class_entry ce;
17 INIT_CLASS_ENTRY(ce, "CairoException", CairoException_methods);
18 CairoException_ce_ptr = zend_register_internal_class_ex(&ce, zend_exception_get_default(), "Exception" TSRMLS_CC);
21 /* }}} Class CairoException */
23 void phpCairoCheckStatus(cairo_status_t status)
25 zend_throw_exception(CairoException_ce_ptr, cairo_status_to_string(status));
26 return;
29 switch(status) {
30 case CAIRO_STATUS_SUCCESS:
31 return 0;
32 case CAIRO_STATUS_NO_MEMORY:
33 zend_throw_exception(CairoException_ce_ptr,"No memory", NULL);
34 break;
35 case CAIRO_STATUS_READ_ERROR:
36 case CAIRO_STATUS_WRITE_ERROR:
37 zend_throw_exception(CairoException_ce_ptr, cairo_status_to_string(status), NULL);
38 break;
39 case CAIRO_STATUS_INVALID_RESTORE:
40 zend_throw_expetion(CairoException_ce_ptr, "Invalid restore", NULL);
41 break;
42 case CAIRO_STATUS_INVALID_POP_GROUP:
43 zend_throw_exception(CairoException_ce_ptr, "Pop group error", NULL);
44 break;
45 } */