Skip to content

Commit abdb34e

Browse files
committed
english
1 parent a7a9a13 commit abdb34e

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

err2.go

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,10 @@ var (
3333
ErrNotRecoverable = errors.New("cannot recover")
3434
ErrRecoverable = errors.New("recoverable")
3535

36-
// Stdnull is helper variable for io.Writer need e.g. err2.SetLogTracer in
37-
// cases you don't want to use automatic log writer, i.e. LogTracer == nil.
38-
// It's usually used to change how the Catch works, e.g., in CLI apps.
36+
// Stdnull implements io.Writer that writes nothing, e.g.,
37+
// err2.SetLogTracer in cases you don't want to use automatic log writer,
38+
// i.e., LogTracer == /dev/null. It can be used to change how the Catch
39+
// works, e.g., in CLI apps.
3940
Stdnull = &nullDev{}
4041
)
4142

@@ -79,11 +80,12 @@ var (
7980
// of them resets the error like Reset (notice other predefined error handlers)
8081
// in next sample:
8182
//
83+
// defer err2.Handle(&err, err2.Reset, err2.Log) // Log not called
8284
// defer err2.Handle(&err, err2.Noop, err2.Log) // handlers > 1: err annotated
8385
// defer err2.Handle(&err, nil, err2.Log) // nil disables auto-annotation
8486
//
8587
// If you need to stop general panics in handler, you can do that by giving a
86-
// panic handler function:
88+
// panic handler function. See the second handler below:
8789
//
8890
// defer err2.Handle(&err,
8991
// err2.Err( func(error) { os.Remove(dst) }), // err2.Err() keeps it short
@@ -130,7 +132,7 @@ func Handle(err *error, a ...any) {
130132
// error message about the error source (from where the error was thrown) to the
131133
// currently set log. Note, when log stream isn't set, the standard log is used.
132134
// It can be bound to, e.g., glog. And if you want to suppress automatic logging
133-
// use the following setup:
135+
// entirely use the following setup:
134136
//
135137
// err2.SetLogTracer(err2.Stdnull)
136138
//

0 commit comments

Comments
 (0)