@@ -328,19 +328,19 @@ func getValueField(value reflect.Value, fields []string) reflect.Value {
328328//
329329// Examples:
330330//
331- // type Foo struct {
332- // // "id" must exist in response. note the leading comma.
333- // Id string `facebook:",required"`
331+ // type Foo struct {
332+ // // "id" must exist in response. note the leading comma.
333+ // Id string `facebook:",required"`
334334//
335- // // use "name" as field name in response.
336- // TheName string `facebook:"name"`
335+ // // use "name" as field name in response.
336+ // TheName string `facebook:"name"`
337337//
338- // // the "json" key also works as expected.
339- // Key string `json:"my_key"`
338+ // // the "json" key also works as expected.
339+ // Key string `json:"my_key"`
340340//
341- // // if both "facebook" and "json" key are set, the "facebook" key is used.
342- // Value string `facebook:"value" json:"shadowed"`
343- // }
341+ // // if both "facebook" and "json" key are set, the "facebook" key is used.
342+ // Value string `facebook:"value" json:"shadowed"`
343+ // }
344344//
345345// To change default behavior, set a struct tag `facebook:",required"` to fields
346346// should not be missing.
@@ -388,12 +388,13 @@ func (res Result) DecodeField(field string, v interface{}) error {
388388// Err returns an error if Result is a Graph API error.
389389//
390390// The returned error can be converted to Error by type assertion.
391- // err := res.Err()
392- // if err != nil {
393- // if e, ok := err.(*Error); ok {
394- // // read more details in e.Message, e.Code and e.Type
395- // }
396- // }
391+ //
392+ // err := res.Err()
393+ // if err != nil {
394+ // if e, ok := err.(*Error); ok {
395+ // // read more details in e.Message, e.Code and e.Type
396+ // }
397+ // }
397398//
398399// For more information about Graph API Errors, see
399400// https://developers.facebook.com/docs/reference/api/errors/
@@ -420,13 +421,14 @@ func (res Result) Err() error {
420421//
421422// Facebook uses following JSON structure to response paging information.
422423// If "data" doesn't present in Result, Paging will return error.
423- // {
424- // "data": [...],
425- // "paging": {
426- // "previous": "https://graph.facebook.com/...",
427- // "next": "https://graph.facebook.com/..."
428- // }
429- // }
424+ //
425+ // {
426+ // "data": [...],
427+ // "paging": {
428+ // "previous": "https://graph.facebook.com/...",
429+ // "next": "https://graph.facebook.com/..."
430+ // }
431+ // }
430432func (res Result ) Paging (session * Session ) (* PagingResult , error ) {
431433 return newPagingResult (session , res )
432434}
@@ -614,7 +616,7 @@ func decodeField(val reflect.Value, field reflect.Value, fullName string) error
614616 data , err := json .Marshal (val .Interface ())
615617
616618 if err != nil {
617- return fmt .Errorf ("facebook: fail to marshal value for field '%v' with error %v " , fullName , err )
619+ return fmt .Errorf ("facebook: fail to marshal value for field '%v' with error %w " , fullName , err )
618620 }
619621
620622 return unmarshaler .UnmarshalJSON (data )
0 commit comments