Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

facebook.BatchApi should return the results and facebook.Error as error, right now it returns standard error #32

Closed
cention-mujibur-rahman opened this issue May 11, 2015 · 2 comments
Labels

Comments

@cention-mujibur-rahman
Copy link

Getting issues while I write this code:
rfb "github.com/huandu/facebook"
url := fmt.Sprintf("%s/feed?fields=id,from,message,created_time,updated_time,picture,likes&until=%d","xxxxxxx")
results, err := rfb.BatchApi("xxxxxxxxxx", rfb.Params{
"method": rfb.GET,
"relative_url": url,
})
if err != nil {
log.Println("Error on connecting: ", err)
}
This is the result body I use to get: results[0].Get("body")
Its working fine if the access_token is ok.
But I need the facebook error code while the access_token is wrong or user change his password or something else happen in facebook api.
In the above cases I got only error message like
"cannot format facebook batch response. json: cannot unmarshal object into Go value of type []facebook.Result" error.
It doesnt make sense to me what is actually causing the error and what is the error message, error code, type and subcode as well.
It causing because in session.go -> graphBatch function is always return []Result but when its having error then its only Result{} and throughing error from makeResult function decode(res)
It will very helpful to me if I can be able to get the facebook error(I mean the Error struct).
Please have a look on it.

@huandu huandu added the bug label May 11, 2015
@huandu huandu closed this as completed in 879fc8a May 11, 2015
@huandu
Copy link
Owner

huandu commented May 11, 2015

@cention-mujibur-rahman Thanks for reporting this issue. I've fixed the issue as you suggested.

@cention-mujibur-rahman
Copy link
Author

@huandu Great thanks. :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants