If a function throws an exception because the calling code does not call it properly, how do I make the error show the file and line number of the calling code instead of (or in addition to) the line where the exception is thrown?
ie:
class MyClass {
public function __call($MethodName, $Parameters)
{
if (!property_exists($this, $PropertyName))
throw new Exception('Error Getting Property: ' . $PropertyName . ' does not exist!');
// THIS line number appears in the exception, but
// is useless because it isn't the problem.
}
}
$MyClass = new MyClass();
// THIS line number should be in the exception,
// since its the line that's wrong.
$MyClass->GetSomethingThatDoesNotExist();