File tree 4 files changed +13
-13
lines changed
4 files changed +13
-13
lines changed Original file line number Diff line number Diff line change @@ -184,28 +184,28 @@ func Throwf(format string, args ...any) {
184
184
panic (err )
185
185
}
186
186
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
188
188
// error to stderr and it resets the current error value. It's a handy Catch
189
189
// handler in main function.
190
190
//
191
191
// You can use it like this:
192
192
//
193
193
// 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 {
196
196
fmt .Fprintln (os .Stderr , err .Error ())
197
197
return nil
198
198
}
199
199
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
201
201
// error to stdout and it resets the current error value. It's a handy Catch
202
202
// handler in main function.
203
203
//
204
204
// You can use it like this:
205
205
//
206
206
// 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 {
209
209
fmt .Fprintln (os .Stdout , err .Error ())
210
210
return nil
211
211
}
Original file line number Diff line number Diff line change @@ -129,7 +129,7 @@ func doPlayMain() {
129
129
//err2.SetFormatter(formatter.Noop) // default is formatter.Decamel
130
130
131
131
// errors are caught without specific handlers.
132
- defer err2 .Catch (err2 .ToStderr )
132
+ defer err2 .Catch (err2 .Stderr )
133
133
134
134
// If you don't want to use tracers or you just need a proper error handler
135
135
// here.
Original file line number Diff line number Diff line change 13
13
)
14
14
15
15
func main () {
16
- defer err2 .Catch (err2 .ToStderr )
16
+ defer err2 .Catch (err2 .Stderr )
17
17
log .SetFlags (log .Lshortfile | log .LstdFlags )
18
18
19
19
flag .Parse ()
Original file line number Diff line number Diff line change 2
2
".source.go" : {
3
3
"defer err2.Catch to stderr" : {
4
4
"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 )"
7
7
},
8
8
"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 )"
12
12
},
13
13
"defer err2.Catch" : {
14
14
"prefix" : " eca" ,
You can’t perform that action at this time.
0 commit comments