()
| 135 | } |
| 136 | |
| 137 | func (e *NewAPIError) ErrorWithStatusCode() string { |
| 138 | if e == nil { |
| 139 | return "" |
| 140 | } |
| 141 | msg := e.Error() |
| 142 | if e.StatusCode == 0 { |
| 143 | return msg |
| 144 | } |
| 145 | if msg == "" { |
| 146 | return fmt.Sprintf("status_code=%d", e.StatusCode) |
| 147 | } |
| 148 | return fmt.Sprintf("status_code=%d, %s", e.StatusCode, msg) |
| 149 | } |
| 150 | |
| 151 | // MaskSensitiveError masks the upstream addresses of the channel that produced |
| 152 | // the error in the error text; see kitutil.MaskSensitiveInfo. |