mirror of
https://github.com/davidallendj/magellan.git
synced 2025-12-20 03:27:03 -07:00
Changed the wording of error messages slightly
This commit is contained in:
parent
cc7bad8b94
commit
0403b2bcbc
11 changed files with 31 additions and 32 deletions
|
|
@ -49,7 +49,7 @@ func MakeRequest(client *http.Client, url string, httpMethod string, body []byte
|
|||
}
|
||||
req, err := http.NewRequest(httpMethod, url, bytes.NewBuffer(body))
|
||||
if err != nil {
|
||||
return nil, nil, fmt.Errorf("could not create new HTTP request: %v", err)
|
||||
return nil, nil, fmt.Errorf("failed tocreate new HTTP request: %v", err)
|
||||
}
|
||||
req.Header.Add("User-Agent", "magellan")
|
||||
for k, v := range headers {
|
||||
|
|
@ -57,12 +57,12 @@ func MakeRequest(client *http.Client, url string, httpMethod string, body []byte
|
|||
}
|
||||
res, err := client.Do(req)
|
||||
if err != nil {
|
||||
return nil, nil, fmt.Errorf("could not make request: %v", err)
|
||||
return nil, nil, fmt.Errorf("failed tomake request: %v", err)
|
||||
}
|
||||
b, err := io.ReadAll(res.Body)
|
||||
res.Body.Close()
|
||||
if err != nil {
|
||||
return nil, nil, fmt.Errorf("could not read response body: %v", err)
|
||||
return nil, nil, fmt.Errorf("failed toread response body: %v", err)
|
||||
}
|
||||
return res, b, err
|
||||
}
|
||||
|
|
@ -76,7 +76,7 @@ func MakeOutputDirectory(path string) (string, error) {
|
|||
// check if path is valid and directory
|
||||
pathExists, err := PathExists(final)
|
||||
if err != nil {
|
||||
return final, fmt.Errorf("could not check for existing path: %v", err)
|
||||
return final, fmt.Errorf("failed tocheck for existing path: %v", err)
|
||||
}
|
||||
if pathExists {
|
||||
// make sure it is directory with 0o644 permissions
|
||||
|
|
@ -86,7 +86,7 @@ func MakeOutputDirectory(path string) (string, error) {
|
|||
// create directory with data + time
|
||||
err = os.MkdirAll(final, 0766)
|
||||
if err != nil {
|
||||
return final, fmt.Errorf("could not make directory: %v", err)
|
||||
return final, fmt.Errorf("failed tomake directory: %v", err)
|
||||
}
|
||||
return final, nil
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue