diff options
Diffstat (limited to 'Examples')
-rw-r--r-- | Examples/Exceptions/ExceptionCatch/exception.php | 2 | ||||
-rw-r--r-- | Examples/Exceptions/ExceptionCatch/exceptionCatch.cpp | 8 |
2 files changed, 5 insertions, 5 deletions
diff --git a/Examples/Exceptions/ExceptionCatch/exception.php b/Examples/Exceptions/ExceptionCatch/exception.php index 0fec704..f0bfe90 100644 --- a/Examples/Exceptions/ExceptionCatch/exception.php +++ b/Examples/Exceptions/ExceptionCatch/exception.php @@ -14,4 +14,4 @@ my_catch_exception_function(function($a, $b, $c) { // throw an exception from PHP - the C++ code will catch this exception throw new Exception("Example exception"); -});} +}); diff --git a/Examples/Exceptions/ExceptionCatch/exceptionCatch.cpp b/Examples/Exceptions/ExceptionCatch/exceptionCatch.cpp index a5f7b96..9efdf93 100644 --- a/Examples/Exceptions/ExceptionCatch/exceptionCatch.cpp +++ b/Examples/Exceptions/ExceptionCatch/exceptionCatch.cpp @@ -11,6 +11,7 @@ * Libraries used. */ #include <phpcpp.h> +#include <iostream> /** * Namespace to use @@ -39,7 +40,8 @@ void my_catch_exception_function(Php::Parameters ¶ms) } catch (Php::Exception &exception) { - // @todo handle the exception that was thrown from PHP space + // handle the exception that was thrown from PHP space + std::cout << "exception caught in CPP code" << std::endl; } } @@ -54,9 +56,7 @@ extern "C" static Php::Extension extension("my_exception_catch","1.0"); // add function to extension - extension.add("my_catch_exception_function", my_catch_exception_function, { - Php::ByVal("callback", Php::callableType); - }); + extension.add("my_catch_exception_function", my_catch_exception_function); // return the extension module return extension.module(); |