@@ -328,19 +328,19 @@ func getValueField(value reflect.Value, fields []string) reflect.Value {
328
328
//
329
329
// Examples:
330
330
//
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"`
334
334
//
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"`
337
337
//
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"`
340
340
//
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
+ // }
344
344
//
345
345
// To change default behavior, set a struct tag `facebook:",required"` to fields
346
346
// should not be missing.
@@ -388,12 +388,13 @@ func (res Result) DecodeField(field string, v interface{}) error {
388
388
// Err returns an error if Result is a Graph API error.
389
389
//
390
390
// 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
+ // }
397
398
//
398
399
// For more information about Graph API Errors, see
399
400
// https://developers.facebook.com/docs/reference/api/errors/
@@ -420,13 +421,14 @@ func (res Result) Err() error {
420
421
//
421
422
// Facebook uses following JSON structure to response paging information.
422
423
// 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
+ // }
430
432
func (res Result ) Paging (session * Session ) (* PagingResult , error ) {
431
433
return newPagingResult (session , res )
432
434
}
@@ -614,7 +616,7 @@ func decodeField(val reflect.Value, field reflect.Value, fullName string) error
614
616
data , err := json .Marshal (val .Interface ())
615
617
616
618
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 )
618
620
}
619
621
620
622
return unmarshaler .UnmarshalJSON (data )
0 commit comments