summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorEmiel Bruijntjes <emiel.bruijntjes@copernica.com>2014-06-19 13:49:07 +0200
committerEmiel Bruijntjes <emiel.bruijntjes@copernica.com>2014-06-19 13:49:07 +0200
commitca60a32c601fe9b0236d3d4717c7b94368a3c172 (patch)
tree882756690ee8e446f7fc9e3ba14313151eddf423 /include
parentc6c68cbc60711b43e8a570d708db3768240fcc5a (diff)
errors are no longer thrown as exceptions, but are php fatal errors, so that they more closely match the zend error reporting system
Diffstat (limited to 'include')
-rw-r--r--include/array.h10
-rw-r--r--include/exception.h10
-rw-r--r--include/object.h8
3 files changed, 19 insertions, 9 deletions
diff --git a/include/array.h b/include/array.h
index 0b6ceb9..4d6b6b1 100644
--- a/include/array.h
+++ b/include/array.h
@@ -31,7 +31,7 @@ public:
Array(const Value &value) : Value(value)
{
// type must be valid
- if (value.type() != Type::Array) throw Php::Exception("Assigning a non-array to an array variable");
+ if (value.type() != Type::Array) throw FatalError("Assigning a non-array to an array variable");
}
/**
@@ -41,7 +41,7 @@ public:
Array(Value &&value) : Value(std::move(value))
{
// type must be valid
- if (value.type() != Type::Array) throw Php::Exception("Moving a non-array to an array variable");
+ if (value.type() != Type::Array) throw FatalError("Moving a non-array to an array variable");
}
/**
@@ -76,7 +76,7 @@ public:
virtual Value &setType(Type type) override
{
// throw exception if things are going wrong
- if (type != Type::Array) throw Php::Exception("Changing type of a fixed array variable");
+ if (type != Type::Array) throw FatalError("Changing type of a fixed array variable");
// call base
return Value::setType(Type::Array);
@@ -93,7 +93,7 @@ public:
if (this == &value) return *this;
// type must be valid
- if (value.type() != Type::Array) throw Php::Exception("Assigning a non-array to a fixed array variable");
+ if (value.type() != Type::Array) throw FatalError("Assigning a non-array to a fixed array variable");
// call base
Value::operator=(value);
@@ -113,7 +113,7 @@ public:
if (this == &value) return *this;
// type must be valid
- if (value.type() != Type::Array) throw Php::Exception("Moving a non-array to a fixed array variable");
+ if (value.type() != Type::Array) throw FatalError("Moving a non-array to a fixed array variable");
// call base
Value::operator=(std::move(value));
diff --git a/include/exception.h b/include/exception.h
index 671df9e..aff0afc 100644
--- a/include/exception.h
+++ b/include/exception.h
@@ -75,6 +75,16 @@ public:
// yes, it is native
return true;
}
+
+ /**
+ * Report this error as a fatal error
+ * @return bool
+ */
+ virtual bool report() const
+ {
+ // this is not done here
+ return false;
+ }
};
/**
diff --git a/include/object.h b/include/object.h
index 97c9482..2e6628a 100644
--- a/include/object.h
+++ b/include/object.h
@@ -31,7 +31,7 @@ public:
Object(Value &&value) : Value(std::move(value))
{
// throw exception in case of problems
- if (value.type() != Type::Object) throw Php::Exception("Constructing an object variable by moving a non object");
+ if (value.type() != Type::Object) throw FatalError("Constructing an object variable by moving a non object");
}
/**
@@ -123,7 +123,7 @@ public:
virtual Value &setType(Type type) override
{
// throw exception if things are going wrong
- if (type != Type::Object) throw Php::Exception("Changing type of a fixed object variable");
+ if (type != Type::Object) throw FatalError("Changing type of a fixed object variable");
// call base
return Value::setType(type);
@@ -140,7 +140,7 @@ public:
if (this == &value) return *this;
// type must be valid
- if (value.type() != Type::Object) throw Php::Exception("Assigning a non-object to an object variable");
+ if (value.type() != Type::Object) throw FatalError("Assigning a non-object to an object variable");
// call base
Value::operator=(value);
@@ -160,7 +160,7 @@ public:
if (this == &value) return *this;
// type must be valid
- if (value.type() != Type::Object) throw Php::Exception("Moving a non-object to an object variable");
+ if (value.type() != Type::Object) throw FatalError("Moving a non-object to an object variable");
// call base
Value::operator=(std::move(value));