Skip to content

Commit

Permalink
Merge pull request #8 from essentialkaos/develop
Browse files Browse the repository at this point in the history
Improve APIError message
  • Loading branch information
andyone authored Oct 31, 2024
2 parents b0595d0 + b167062 commit f0bf15a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
5 changes: 4 additions & 1 deletion pachca.go
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,10 @@ func (d *Date) UnmarshalJSON(b []byte) error {

// Error returns error text
func (e APIError) Error() string {
return fmt.Sprintf("(%s) %s [%s:%s]", e.Code, e.Message, e.Key, e.Value)
return fmt.Sprintf(
"(%s) %s [%s:%s]",
e.Code, e.Message, e.Key, strutil.Q(e.Value, "-"),
)
}

// ////////////////////////////////////////////////////////////////////////////////// //
Expand Down
2 changes: 1 addition & 1 deletion pachca_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -558,5 +558,5 @@ func (s *PachcaSuite) TestAPIErrorToString(c *C) {
StatusCode: 400,
}

c.Assert(err.Error(), Equals, "(unhandled) Ошибка выполнения запроса [system:]")
c.Assert(err.Error(), Equals, "(unhandled) Ошибка выполнения запроса [system:-]")
}

0 comments on commit f0bf15a

Please sign in to comment.