summaryrefslogtreecommitdiff
path: root/src/exception.cpp
blob: 810a73cb0e0cf5c64c6a8336df48ccedcc03b557 (plain)
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
/**
 *  Exception.cpp
 *
 *  Implementation for the exception class
 *
 *  @author Emiel Bruijntjes <emiel.bruijntjes@copernica.com>
 *  @copyright 2014 Copernica BV
 */
#include "includes.h"

/**
 *  Set up namespace
 */
namespace Php {

/**
 *  Process the exception
 * 
 *  This method is called only from within the PHP-CPP library,
 *  and will turn the exception into a PHP exception
 * 
 *  @param  tsrm_ls
 */
void Exception::process(TSRMLS_D)
{
    // an exception originally thrown by C++ should be passed on to PHP
    zend_throw_exception(zend_exception_get_default(TSRMLS_C), (char*)message().c_str(), 0 TSRMLS_CC);
}

/**
 *  End namespace
 */
}