summaryrefslogtreecommitdiff
path: root/src/origexception.h
diff options
context:
space:
mode:
authorEmiel Bruijntjes <emiel.bruijntjes@copernica.com>2014-03-10 14:10:16 +0100
committerEmiel Bruijntjes <emiel.bruijntjes@copernica.com>2014-03-10 14:10:16 +0100
commit81861258bef606bcdf14d170fb73cd06e25e5ebe (patch)
tree7b9027d8d461046ee982e059da08d54f4664f4ee /src/origexception.h
parentdd3422f6ed454d06e6091ad5023da7fc294595b8 (diff)
deal with magic methods and magic interfaces that throw exceptions
Diffstat (limited to 'src/origexception.h')
-rw-r--r--src/origexception.h27
1 files changed, 21 insertions, 6 deletions
diff --git a/src/origexception.h b/src/origexception.h
index ca59e7f..c1b2871 100644
--- a/src/origexception.h
+++ b/src/origexception.h
@@ -23,26 +23,34 @@ private:
* Has the exception been restored by the C++ code so that it can be dealt by PHP?
* @var boolean
*/
- bool _restored;
+ bool _restored = false;
public:
/**
* Constructor
* @param zval
*/
- OrigException(struct _zval_struct *zval);
+ OrigException(struct _zval_struct *zval) :
+ Value(zval), Exception("OrigException") {}
/**
* Copy constructor
* @param exception
*/
- OrigException(const OrigException &exception);
+ OrigException(const OrigException &exception) :
+ Value(exception), Exception("OrigException"), _restored(exception._restored) {}
/**
* Move constructor
* @param exception
*/
- OrigException(OrigException &&exception);
+ OrigException(OrigException &&exception) :
+ Value(std::move(exception)), Exception("OrigException"), _restored(exception._restored)
+ {
+ // set other exception to restored so that it wont
+ // do anything on destruction
+ exception._restored = true;
+ }
/**
* Destructor
@@ -50,10 +58,17 @@ public:
virtual ~OrigException() throw();
/**
- * Restore the exception - because the exception was not handled by C++ code
+ * Process the exception
+ *
+ * This will restore the exception so that it can be further processed
+ * in PHP code
* @internal
*/
- void restore();
+ virtual void process() override
+ {
+ // mark exception as restored
+ _restored = true;
+ }
};
/**