$e->message()
Is the problem. That refers to a class called Exception
which is expected to have a method called message
, but your Exception
class does not have that method.
Look at the constructor of your Exception
. You're passing in a message when you throw it, perhaps you're looking for $e->getMessage()
.
Read here: http://www.php.net/manual/en/exception.getmessage.php
To summarize, consider this:
class Exception {
//construct is used when you throw new Exception (instantiate the class)
public function __construct($message) {
$this->message = $message; //now the object has a "message" property
}
//this is a "getter" for this object's message
public function getMessage() {
return $this->message; //return the message
}
}
Note that the standard usage of getters/setters
is to use getProperty
and setProperty
as the method name that returns/sets that property.