forked from huandu/facebook
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patherror.go
30 lines (26 loc) · 882 Bytes
/
error.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
// A facebook graph api client in go.
// https://github.com/huandu/facebook/
//
// Copyright 2012, Huan Du
// Licensed under the MIT license
// https://github.com/huandu/facebook/blob/master/LICENSE
package facebook
import (
"fmt"
)
// Error represents Facebook API error.
type Error struct {
Message string
Type string
Code int
ErrorSubcode int // subcode for authentication related errors.
UserTitle string `json:"error_user_title,omitempty"`
UserMessage string `json:"error_user_msg,omitempty"`
IsTransient bool `json:"is_transient,omitempty"`
TraceID string `json:"fbtrace_id,omitempty"`
}
// Error returns error string.
func (e *Error) Error() string {
return fmt.Sprintf("facebook: %s (code: %d; error_subcode: %d, error_user_title: %s, error_user_msg: %s)",
e.Message, e.Code, e.ErrorSubcode, e.UserTitle, e.UserMessage)
}