mirror of
https://codeberg.org/scip/esctl.git
synced 2026-08-24 06:34:18 +02:00
internal/gofix and fix error wrapping (#76)
This commit is contained in:
@@ -94,7 +94,7 @@ func ApiRepl(conf *cfg.Config) error {
|
||||
})
|
||||
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to initialize readline lib: %s", err)
|
||||
return fmt.Errorf("failed to initialize readline lib: %w", err)
|
||||
}
|
||||
|
||||
for {
|
||||
@@ -237,7 +237,7 @@ func CallAPI(conf *cfg.Config, verb, path, data string) ([]byte, error) {
|
||||
// Read and print response
|
||||
body, err := io.ReadAll(resp.Body)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to read response body: %s", err)
|
||||
return nil, fmt.Errorf("failed to read response body: %w", err)
|
||||
}
|
||||
|
||||
return body, nil
|
||||
@@ -261,7 +261,7 @@ func prettyfiJson(conf *cfg.Config, raw []byte) (string, error) {
|
||||
var pretty bytes.Buffer
|
||||
err := json.Indent(&pretty, raw, "", "\t")
|
||||
if err != nil {
|
||||
return "", fmt.Errorf("json parse error: %s", err)
|
||||
return "", fmt.Errorf("json parse error: %w", err)
|
||||
}
|
||||
|
||||
return pretty.String(), nil
|
||||
@@ -295,7 +295,7 @@ func readJSON(input string) (string, error) {
|
||||
check := map[string]any{}
|
||||
err := json.Unmarshal([]byte(data), &check)
|
||||
if err != nil {
|
||||
return "", fmt.Errorf("error: input data is not proper JSON: %s", err)
|
||||
return "", fmt.Errorf("error: input data is not proper JSON: %w", err)
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user