summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJasperVanEck <jaspergkurtz@gmail.com>2013-11-28 16:50:12 +0100
committerJasperVanEck <jaspergkurtz@gmail.com>2013-11-28 16:50:12 +0100
commitb6665b72996d23522d8a277cf4acc3d46e5e11fa (patch)
tree816b5225806f60a043e35faa366f5becf9ca2f9f /src
parent9185842b1d2fd352f6d71a46d2017fa25cc3c6a7 (diff)
Added a very basic exception class, and added an exception example
Diffstat (limited to 'src')
-rw-r--r--src/exception.cpp17
-rw-r--r--src/function.cpp19
-rw-r--r--src/includes.h4
-rwxr-xr-xsrc/libphpcpp.sobin132258 -> 132736 bytes
4 files changed, 27 insertions, 13 deletions
diff --git a/src/exception.cpp b/src/exception.cpp
new file mode 100644
index 0000000..19591db
--- /dev/null
+++ b/src/exception.cpp
@@ -0,0 +1,17 @@
+/**
+ * Exception.cpp
+ * Implementation of Php Exceptions.
+ *
+ * @author Jasper van Eck <jasper.vaneck@copernica.com>
+ * @copyright 2013 Copernica BV
+ */
+
+#include "includes.h"
+
+/**
+ * Set up namespace
+ */
+namespace Php {
+
+
+}
diff --git a/src/function.cpp b/src/function.cpp
index 9376751..fe96745 100644
--- a/src/function.cpp
+++ b/src/function.cpp
@@ -38,20 +38,15 @@ void invoke_function(INTERNAL_FUNCTION_PARAMETERS)
Parameters params(this_ptr, ZEND_NUM_ARGS());
// the function could throw an exception
- //try
- //{
+ try
+ {
// get the result
result = function->invoke(*PHPCPP_G(environment), params);
- //}
- //catch (const Php::Exception &exception)
- //{
- // cout << "got exception";
-
- // @todo throw the exception....
-
-
-
- //}
+ }
+ catch (const Php::Exception &exception)
+ {
+ zend_throw_exception(zend_exception_get_default(), exception.getMessage(), 0 TSRMLS_CC);
+ }
}
/**
diff --git a/src/includes.h b/src/includes.h
index 87b5d64..ac99950 100644
--- a/src/includes.h
+++ b/src/includes.h
@@ -17,6 +17,7 @@
#include <map>
#include <memory>
#include <set>
+#include <exception>
// for debugging
#include <iostream>
@@ -25,7 +26,7 @@
* PHP includes
*/
#include <php.h>
-
+#include "zend_exceptions.h"
/**
* Macro to convert results to success status
*/
@@ -55,6 +56,7 @@
#include "../include/class.h"
#include "../include/classinfo.h"
#include "../include/extension.h"
+#include "../include/exception.h"
#include "../include/globals.h"
/**
diff --git a/src/libphpcpp.so b/src/libphpcpp.so
index 2c5827d..8403d89 100755
--- a/src/libphpcpp.so
+++ b/src/libphpcpp.so
Binary files differ