Skip to content

Commit

Permalink
Remove rendering of original error in K6Error
Browse files Browse the repository at this point in the history
  • Loading branch information
Ivan Mirić committed Jun 4, 2021
1 parent 17f6df6 commit b894ab7
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
5 changes: 1 addition & 4 deletions lib/netext/httpext/error_codes.go
Original file line number Diff line number Diff line change
Expand Up @@ -235,10 +235,7 @@ func NewK6Error(code errCode, msg string, originalErr error) K6Error {

// Error implements the `error` interface, so K6Errors are normal Go errors.
func (k6Err K6Error) Error() string {
if k6Err.OriginalError == nil {
return k6Err.Message
}
return fmt.Sprintf("%s: %s", k6Err.Message, k6Err.OriginalError)
return k6Err.Message
}

// Unwrap implements the `xerrors.Wrapper` interface, so K6Errors are a bit
Expand Down
3 changes: 2 additions & 1 deletion lib/netext/httpext/url.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ type URL struct {
func NewURL(urlString, name string) (URL, error) {
u, err := url.Parse(urlString)
if err != nil {
return URL{}, NewK6Error(invalidURLErrorCode, invalidURLErrorCodeMsg, err)
return URL{}, NewK6Error(invalidURLErrorCode,
fmt.Sprintf("%s: %s", invalidURLErrorCodeMsg, err), err)
}
newURL := URL{u: u, Name: name, URL: urlString}
newURL.CleanURL = newURL.Clean()
Expand Down

0 comments on commit b894ab7

Please sign in to comment.