I am loading in some graph data and want to check for error so I can hide the element and avoid broken code on the page.
If there is a problem Facebook responds with something like this:
{
"error": {
"type": "OAuthException",
"message": "(#803) Some of the aliases you requested do not exist: asd"
}
}
How do I check for that?
If that’s the JSON object you’re getting back, in your code just check if it contains an ‘error’ object. At that point you should be able to see the error details.
If you happen to be using the PHP SDK you can wrap calls to the
apimethod within a try/catch block and deal with errors that way.