You may have already found a solution, but hopefully this helps someone else.
The problem is that you do not know the names of the child nodes in the response object. If you cannot name a specific node, then you will constantly receive this error message: "An error has occurred [Message of object of object]β
I have a workaround that will allow you to see the error message without knowing the names of the child nodes of the response object. JSON.stringify simply converts the entire object to a string, allowing you to view its contents. It will not be very good, but you will definitely see an error message.
Try the following:
<script type="text/javascript"> function postCook() { $pageURL = window.location; FB.api('/me/bgfapp:watch?movie=' + $pageURL,'post', function(response) { if (!response || response.error) { alert(JSON.stringify(response)); } else { alert('Post was successful! Action ID: ' + response.id); } }); }
An alternative solution would be to output the contents of the response object to the console, rather than executing a warning, just replace line 7 in my code example as follows:
console.log(response);
Here you can open the development console of your web browser and go through the contents of the response object. Since the console is not always available (for example, applications with telephone recordings), the previous solution is sometimes more suitable.
source share