summaryrefslogtreecommitdiff
path: root/src/exception.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/exception.cpp')
-rw-r--r--src/exception.cpp32
1 files changed, 32 insertions, 0 deletions
diff --git a/src/exception.cpp b/src/exception.cpp
new file mode 100644
index 0000000..83c1d12
--- /dev/null
+++ b/src/exception.cpp
@@ -0,0 +1,32 @@
+/**
+ * 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 withing the PHP-CPP library,
+ * and will turn the exception into a PHP exception
+ */
+void Exception::process()
+{
+ // an exception originally thrown by C++ should be passed on to PHP
+ zend_throw_exception(zend_exception_get_default(), (char*)message().c_str(), 0 TSRMLS_CC);
+}
+
+/**
+ * End namespace
+ */
+}
+