Is it possible to remove the trace elements from the __toString.
What I want is something like this.
class DBException extends PDOException
{
public function __toString()
{
return get_class($this) . " '{$this->getMessage()}' in {$this->getFile()}({$this->getLine()})\n";
}
}
I've tried the above method but it doesn't seem to work. Any ideas?
If I use a try catch block below as example, I still get the trace data.
try {
// Do something here
}catch(DBException $e) {
echo $e;
}
I would have thought that echoing $e would trigger the __toString method in my DBException class.