Skip to content

Commit

Permalink
Mark Error and Errorf as deprecated
Browse files Browse the repository at this point in the history
With `fmt.Errorf`, there is no good reason for this function anymore.
  • Loading branch information
HeavyWombat committed Oct 15, 2023
1 parent 92a2e4d commit a653556
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions error.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,8 @@ func (e *wrappedErrors) Errors() []error {
}

// Error creates an error with additional context
//
// Deprecated: Use fmt.Errorf() instead using the `%w` format specifier.
func Error(err error, context string) error {
switch {
case err == nil:
Expand All @@ -93,6 +95,8 @@ func Error(err error, context string) error {
}

// Errorf creates an error with additional formatted context
//
// Deprecated: Use fmt.Errorf() instead using the `%w` format specifier.
func Errorf(err error, format string, a ...interface{}) error {
return Error(err, fmt.Sprintf(format, a...))
}
Expand Down

0 comments on commit a653556

Please sign in to comment.