error handling php sdk

The first gets the object that is the result of the error or exception returned by the server. This is an array containing the error message from the server. The second gets the type for the error or exception, e.g. OAuthException.

GET RESULT ERROR OBJECT
try {
  $facebook->api('mefeed','POST',
                   array( 
                     'message' => 'Hello World!',
                     'link' => 'www.example.com'
                        )
                );
} catch(FacebookApiException $e) {
  $result = $e->getResult();
  error_log(json_encode($result));
}


GET TYPE OF ERROR
try {
  $facebook->api('mefeed','POST',
                   array( 
                     'message' => 'Hello World!',
                     'link' => 'www.example.com'
                        )
                );
} catch(FacebookApiException $e) {
  $e_type = $e->getType();
  error_log('Got an ' . $e_type . ' while posting');
}