Question

I am using FB Connect and the PHP class called Facebook, that is provided by FB. Whenever something goes wrong FB throws Fatal Error and application dies. That's great for testing but now very nice for production code. I've looked through code and can't find a way to disable that but may be I overlooked something. So, is there any way to disable fatal errors other than looking through their class and removing every line like this

throw new FacebookApiException($result);
Was it helpful?

Solution

You should catch exceptions, not remove them.

try {
  //do something with the facebook api
}
catch (FacebookApiException $e) {
  //an error occured, handle it
}

And btw: fatal errors are different from exceptions.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top