-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathpmta_error.h
58 lines (50 loc) · 1.95 KB
/
pmta_error.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
/**
* @file pmta_error.h
* @date Sep 29, 2010 v0.1
* @date Jul 11, 2013 v0.4
* @author Vladimir Kolesnikov <[email protected]>
* @brief Exposes @c PmtaError, @c PmtaErrorConnection, @c PmtaErrorRecipient and @c PmtaErrorMessage classes
* @note If @c HAVE_SPL macro evaluates to non-zero, @c PmtaError class is derived from @c RuntimeException, not from @c Exception
* @details
@code{.php}
class PmtaError extends Exception
{
const OUT_OF_MEMORY = PmtaApiERROR_OutOfMemory;
const ILLEGAL_STATE = PmtaApiERROR_IllegalState;
const ILLEGAL_ARGUMENT = PmtaApiERROR_IllegalArgument;
const SECURITY = PmtaApiERROR_Security;
const IO = PmtaApiERROR_IO;
const SERVICE = PmtaApiERROR_Service;
const EMAIL_ADDRESS = PmtaApiERROR_EmailAddress;
const PHP_API = PmtaApiERROR_PHP_API;
}
final class PmtaErrorConnection extends PmtaError { }
final class PmtaErrorRecipient extends PmtaError { }
final class PmtaErrorMessage extends PmtaError { }
@endcode
*/
#ifdef DOXYGEN
# undef PMTA_ERROR_H
#endif
#ifndef PMTA_ERROR_H
#define PMTA_ERROR_H
#include "php_pmta.h"
/**
* @brief PHP API error
*/
#define PmtaApiERROR_PHP_API 255
/**
* @brief registers PmtaError and derived classes
* @param tsrm_ls Internally used by Zend
*/
PHPPMTA_VISIBILITY_HIDDEN extern void pmtaerror_register_class(TSRMLS_D);
/**
* @brief Instantiates PmtaError or derived from it class
* @param error_class Class to instantiate
* @param code Error code (typically the return value of @c PmtaXXXGetLastErrorType())
* @param message Error message (typically the return value of @c PmtaXXXGetLastError())
* @param result If @c NULL, throws the exception with the instantiated class; otherwise, this is where the result is placed
* @param tsrm_ls Internally used by Zend
*/
PHPPMTA_VISIBILITY_HIDDEN extern void throw_pmta_error(zend_class_entry* error_class, int code, const char* message, zval** result TSRMLS_DC);
#endif /* PMTA_ERROR_H */