Skip to content

Commit fe51c7f

Browse files
committed
ToStdout -> Stdout
1 parent f43bd01 commit fe51c7f

File tree

4 files changed

+13
-13
lines changed

4 files changed

+13
-13
lines changed

err2.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -184,28 +184,28 @@ func Throwf(format string, args ...any) {
184184
panic(err)
185185
}
186186

187-
// ToStderr is a built-in helper to use with Handle and Catch. It prints the
187+
// Stderr is a built-in helper to use with Handle and Catch. It prints the
188188
// error to stderr and it resets the current error value. It's a handy Catch
189189
// handler in main function.
190190
//
191191
// You can use it like this:
192192
//
193193
// func main() {
194-
// defer err2.Catch(err2.ToStderr)
195-
func ToStderr(err error) error {
194+
// defer err2.Catch(err2.Stderr)
195+
func Stderr(err error) error {
196196
fmt.Fprintln(os.Stderr, err.Error())
197197
return nil
198198
}
199199

200-
// ToStdout is a built-in helper to use with Handle and Catch. It prints the
200+
// Stdout is a built-in helper to use with Handle and Catch. It prints the
201201
// error to stdout and it resets the current error value. It's a handy Catch
202202
// handler in main function.
203203
//
204204
// You can use it like this:
205205
//
206206
// func main() {
207-
// defer err2.Catch(err2.ToStdout)
208-
func ToStdout(err error) error {
207+
// defer err2.Catch(err2.Stdout)
208+
func Stdout(err error) error {
209209
fmt.Fprintln(os.Stdout, err.Error())
210210
return nil
211211
}

samples/main-play.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ func doPlayMain() {
129129
//err2.SetFormatter(formatter.Noop) // default is formatter.Decamel
130130

131131
// errors are caught without specific handlers.
132-
defer err2.Catch(err2.ToStderr)
132+
defer err2.Catch(err2.Stderr)
133133

134134
// If you don't want to use tracers or you just need a proper error handler
135135
// here.

samples/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ var (
1313
)
1414

1515
func main() {
16-
defer err2.Catch(err2.ToStderr)
16+
defer err2.Catch(err2.Stderr)
1717
log.SetFlags(log.Lshortfile | log.LstdFlags)
1818

1919
flag.Parse()

snippets/go.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@
22
".source.go": {
33
"defer err2.Catch to stderr": {
44
"prefix": "ecte",
5-
"body": "defer err2.Catch(err2.ToStderr)\n",
6-
"description": "Snippet for err2.Catch(ToStderr)"
5+
"body": "defer err2.Catch(err2.Stderr)\n",
6+
"description": "Snippet for err2.Catch(Stderr)"
77
},
88
"defer err2.Catch to stdout": {
9-
"prefix": "ecte",
10-
"body": "defer err2.Catch(err2.ToStdout)\n",
11-
"description": "Snippet for err2.Catch(ToStdout)"
9+
"prefix": "ecto",
10+
"body": "defer err2.Catch(err2.Stdout)\n",
11+
"description": "Snippet for err2.Catch(Stdout)"
1212
},
1313
"defer err2.Catch": {
1414
"prefix": "eca",

0 commit comments

Comments
 (0)