Loading .gitignore +2 −0 Original line number Diff line number Diff line Loading @@ -32,3 +32,5 @@ ### VS Code ### /.vscode/ reports/coverage.out reports/coverage.out cmd/vault_service/internal/vault_model.go +16 −19 Original line number Diff line number Diff line Loading @@ -35,15 +35,14 @@ const ( */ type ErrorResponse struct { Errors []string `json:"errors"` normalized bool } func (er ErrorResponse) Error() string { if !er.normalized { normErrors := make([]string, 0) r, _ := regexp.Compile(`^(\d+) errors? occurred:`) for i := 0; i < len(er.Errors); i++ { // nolint if match, _ := regexp.MatchString("^(\\d+) errors? occurred:", er.Errors[i]); match { if match := r.MatchString(er.Errors[i]); match { // this is a multiline error: extract and normalize each line starting with "* " lines := strings.Split(er.Errors[i], "\n") for ln := 0; ln < len(lines); ln++ { Loading @@ -58,8 +57,6 @@ func (er ErrorResponse) Error() string { } } er.Errors = normErrors er.normalized = true } return strings.Join(er.Errors, ", ") } Loading Loading
.gitignore +2 −0 Original line number Diff line number Diff line Loading @@ -32,3 +32,5 @@ ### VS Code ### /.vscode/ reports/coverage.out reports/coverage.out
cmd/vault_service/internal/vault_model.go +16 −19 Original line number Diff line number Diff line Loading @@ -35,15 +35,14 @@ const ( */ type ErrorResponse struct { Errors []string `json:"errors"` normalized bool } func (er ErrorResponse) Error() string { if !er.normalized { normErrors := make([]string, 0) r, _ := regexp.Compile(`^(\d+) errors? occurred:`) for i := 0; i < len(er.Errors); i++ { // nolint if match, _ := regexp.MatchString("^(\\d+) errors? occurred:", er.Errors[i]); match { if match := r.MatchString(er.Errors[i]); match { // this is a multiline error: extract and normalize each line starting with "* " lines := strings.Split(er.Errors[i], "\n") for ln := 0; ln < len(lines); ln++ { Loading @@ -58,8 +57,6 @@ func (er ErrorResponse) Error() string { } } er.Errors = normErrors er.normalized = true } return strings.Join(er.Errors, ", ") } Loading