Fix OpenAI or Azure returns an undefined error message return (#283)

* Fix OpenAI or Azure returns an undefined error message return

* Fix: OpenAI or Azure returns an undefined error message return
#280

* Fix: OpenAI or Azure returns an undefined error message return
#280

* Fix: OpenAI or Azure returns an undefined error message return
#280

Handle long line

* Fix: OpenAI or Azure returns an undefined error message return
#280

Add unit test ErrorResponse nil pointer check

* Fix: OpenAI or Azure returns an undefined error message return
#280

Add unit test ErrorResponse nil pointer check

---------

Co-authored-by: zhangxm <xuanming_zhang@qingsongchou.com>
This commit is contained in:
xuanming.zhang
2023-05-01 05:21:15 +08:00
committed by GitHub
parent cacd976a0c
commit 67aef196d2
2 changed files with 83 additions and 0 deletions

View File

@@ -148,6 +148,9 @@ func (c *Client) handleErrorResp(resp *http.Response) error {
HTTPStatusCode: resp.StatusCode,
Err: err,
}
if errRes.Error != nil {
reqErr.Err = errRes.Error
}
return fmt.Errorf("error, %w", &reqErr)
}
errRes.Error.HTTPStatusCode = resp.StatusCode