Help > Usage, Naming, Markdown Help, Spelling, File name Sanitization

This commit is contained in:
luke-hagar-sp
2023-08-04 16:01:26 -05:00
parent a75043ad8f
commit b2f330fd48
65 changed files with 683 additions and 412 deletions

View File

@@ -4,7 +4,7 @@ import (
"encoding/json"
"errors"
"fmt"
"io/ioutil"
"io"
"net/http"
"github.com/charmbracelet/log"
@@ -26,7 +26,7 @@ type SDKResp struct {
func HandleSDKError(resp *http.Response, sdkErr error) error {
defer resp.Body.Close()
body, err := ioutil.ReadAll(resp.Body)
body, err := io.ReadAll(resp.Body)
if err != nil {
log.Error(err)
}
@@ -43,8 +43,8 @@ func HandleSDKError(resp *http.Response, sdkErr error) error {
for _, v := range formattedBody.Messages {
outputErr = outputErr + fmt.Sprintf("%s\n", v.Text)
}
} else {
} else if len(body) > 0 {
outputErr = outputErr + fmt.Sprintf("%s\n", string(body))
}
return errors.New(outputErr)