Skip to content

Commit

Permalink
Merge pull request #79 from guywithnose/master
Browse files Browse the repository at this point in the history
Include the error context in the error string
  • Loading branch information
mattfarina authored Sep 11, 2017
2 parents eabae39 + d8a3434 commit 98687a3
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions errors.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
package vcs

import "errors"
import (
"errors"
"fmt"
)

// The vcs package provides ways to work with errors that hide the underlying
// implementation details but make them accessible if needed. For basic errors
Expand Down Expand Up @@ -93,7 +96,11 @@ type vcsError struct {

// Error implements the Error interface
func (e *vcsError) Error() string {
return e.s
if e.e == nil {
return e.s
}

return fmt.Sprintf("%s: %v", e.s, e.e)
}

// Original retrieves the underlying implementation specific error.
Expand Down

0 comments on commit 98687a3

Please sign in to comment.