mirror of
https://github.com/crunchy-labs/crunchy-cli.git
synced 2026-01-21 12:12:00 -06:00
Add better error output
This commit is contained in:
parent
72484c78af
commit
9f6a225caf
1 changed files with 5 additions and 0 deletions
|
|
@ -328,6 +328,11 @@ func request(req *http.Request, client *http.Client) (*http.Response, error) {
|
||||||
return nil, &RequestError{Response: resp, Message: msg}
|
return nil, &RequestError{Response: resp, Message: msg}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else if _, ok := errMap["code"]; ok {
|
||||||
|
if errContext, ok := errMap["context"]; ok {
|
||||||
|
errField := errContext.([]any)[0].(map[string]any)
|
||||||
|
return nil, &RequestError{Response: resp, Message: fmt.Sprintf("%s - %s", errField["code"].(string), errField["field"].(string))}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue