(data interface{})
| 138 | } |
| 139 | |
| 140 | func (c ResponseCode) ToOpenAIErrorRespone(data interface{}) OpenAIErrorResponse { |
| 141 | msg := c.Message() |
| 142 | if err, ok := data.(error); ok { |
| 143 | msg += ": " + err.Error() |
| 144 | } |
| 145 | // data if str |
| 146 | if str, ok := data.(string); ok { |
| 147 | msg += ": " + str |
| 148 | } |
| 149 | |
| 150 | return OpenAIErrorResponse{ |
| 151 | Error: OpenAIError{ |
| 152 | Message: msg, |
| 153 | Type: "53aihub_error", |
| 154 | }, |
| 155 | } |
| 156 | } |
no test coverage detected