Im working on API in which I'm trying to add custom message when PHP script fails to run.
What I come up with was
try {
//some codes
} catch (Exception $e){
//something
}
and
set_error_handler("someFunction");
function displayError() {
echo "An error occurred bor";
}
But What exactly I need is, an error handler lets say, when PHP is unable to run code because of runtime error, or syntax error, it should show specific message on the API. If possible?