I use my own simple error handling and can actually catch&log everything I need. But now I need to catch an error with try{}catch(){}
. The error, that I expect occurring sometimes at that place, is the "Call to undefined method" error. I can catch it like this:
try {
$someObject->someMethodTheObjectDoesntProvide();
} catch (Error $e) {
// do something else
}
But the Error
class in the catch
clause is a bit to generic. I'd like to catch only this type of error.
Is there a way to restrict the catching to a particular "type" of errors?
Without using strpos($errorMessage)
... ;)