forked from TencentCloud/tencentcloud-cls-sdk-go
/
attempt.go
52 lines (46 loc) · 1.16 KB
/
attempt.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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
package tencentcloud_cls_sdk_go
type Attempt struct {
Success bool
RequestId string
ErrorCode string
ErrorMessage string
TimeStampMs int64
}
// NewAttempt init attempt
func NewAttempt(success bool, requestId, errorCode, errorMessage string, timeStampMs int64) *Attempt {
return &Attempt{
Success: success,
RequestId: requestId,
ErrorCode: errorCode,
ErrorMessage: errorMessage,
TimeStampMs: timeStampMs,
}
}
func (result *Result) GetErrorCode() string {
if len(result.attemptList) == 0 {
return ""
}
cursor := len(result.attemptList) - 1
return result.attemptList[cursor].ErrorCode
}
func (result *Result) GetErrorMessage() string {
if len(result.attemptList) == 0 {
return ""
}
cursor := len(result.attemptList) - 1
return result.attemptList[cursor].ErrorMessage
}
func (result *Result) GetRequestId() string {
if len(result.attemptList) == 0 {
return ""
}
cursor := len(result.attemptList) - 1
return result.attemptList[cursor].RequestId
}
func (result *Result) GetTimeStampMs() int64 {
if len(result.attemptList) == 0 {
return 0
}
cursor := len(result.attemptList) - 1
return result.attemptList[cursor].TimeStampMs
}