Skip to content

Commit bbf85b6

Browse files
committed
Handler must be a type alias, and keep it to handler pkg
1 parent ca7e9a8 commit bbf85b6

File tree

2 files changed

+3
-12
lines changed

2 files changed

+3
-12
lines changed

err2.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ type (
1111
// Handler is a function type used to process error values in Handle and
1212
// Catch. We currently have a few build-ins of the Handler: err2.Noop,
1313
// err2.Reset, etc.
14-
Handler = func(error) error
14+
Handler = handler.ErrorFn
1515
)
1616

1717
var (

handlers.go

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,8 @@ import (
55
"os"
66
)
77

8-
// Handlers is a helper to call several error handlers in a sequence.
9-
//
10-
// defer err2.Handle(&err, err2.Handlers(err2.Log, MapToHTTPErr))
11-
func Handlers(f ...Handler) Handler {
12-
return func(err error) error {
13-
for _, handler := range f {
14-
err = handler(err)
15-
}
16-
return err
17-
}
18-
}
8+
"github.com/lainio/err2/internal/handler"
9+
)
1910

2011
// Stderr is a built-in helper to use with Handle and Catch. It prints the
2112
// error to stderr and it resets the current error value. It's a handy Catch

0 commit comments

Comments
 (0)