1
0
Fork 0
mirror of synced 2025-04-04 21:53:37 +03:00

Restore checkFacebookError

This commit is contained in:
Pavel 2021-02-08 17:32:34 +03:00
parent b536bf7766
commit 6051f67ddb

View file

@ -81,6 +81,21 @@ func (e QueryError) Error() string {
return e.Message
}
func checkFacebookError(r io.Reader) error {
var err error
qr := QueryResponse{}
err = json.NewDecoder(r).Decode(&qr)
if err != nil {
return xerrors.Errorf("json unmarshal error: %w", err)
}
if qr.Error != nil {
return xerrors.Errorf("facebook error: %w", qr.Error)
}
return nil
}
func getFacebookQueryResponse(r io.Reader) (QueryResponse, error) {
qr := QueryResponse{}
err := json.NewDecoder(r).Decode(&qr)