facebook/facebook-php-sdk-v4 — pull request #286 by SammyK (2014-12-05 23:51:16+00:00)
Title: [4.1] Improved exception handling

This PR cleans up the way exceptions are handled a bit and removes some of the archaic dingle-berries.

The main thing that has changed is the way specific exceptions are thrown based on responses from Graph. Instead of extending the `FacebookResponseException` vertically, it is now handled horizontally by making use of `$e->getPrevious()`. This gives the developer a bit more flexibility when handling the thrown exceptions without having to write a `catch` block for all 6 possible response exceptions.

```php
try {
// Some stuffs
} catch (FacebookResponseException $e) {
echo 'Message: ' . $e->getMessage();
$previousException = $e->getPrevious();
// Do some further processing on $previousException
}
```

Now, I didn't change it in this PR, but I'd like to propose we rebase this PR with two pretty big BC's before 4.1 launch:

1. Rename `FacebookSDKException` to `FacebookSdkException` to be consistent with the naming schema throughout the rest of the SDK.
2. Rename all exceptions that deal with error responses from the Graph API to `GraphError*` instead of `Facebook*`. It makes a lot more sense for example for `FacebookOtherException` to be named `GraphErrorOtherException` since it's a lot clearer what it pertains to. This would include `FacebookResponseException` being renamed to `GraphErrorResponseException`. Wudya think? :)