Skip to content

Commit

Permalink
Add comment for falta.Capture
Browse files Browse the repository at this point in the history
  • Loading branch information
a20r committed Oct 27, 2023
1 parent 9d335e7 commit 2df802d
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,10 @@ func (f Falta) Is(err error) bool {
return errors.As(err, &other) && other.errFmt == f.errFmt || err.Error() == f.errFmt
}

// Capture captures the error provided and wraps it with the Falta instance if it's not nil. This should be called
// with defer at the top of the function for which you are trying to capture the error. This ensures that all errors
// returned from your function will be wrapped by the function passed into Capture. You should use a named return
// value for the error so that the error Capture wraps is the one returned from teh function.
func (f Falta) Capture(err *error) {
if *err != nil {
*err = f.Wrap(*err)
Expand Down

0 comments on commit 2df802d

Please sign in to comment.