Skip to content

Commit 406337b

Browse files
committed
-rm-try flag
1 parent ece6e9a commit 406337b

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

samples/main.go

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,16 +19,13 @@ var (
1919
"\nplay-recursion (= runs recursion example)",
2020
)
2121
isErr = flag.Bool("err", false, "tells if we want to have an error")
22+
rmTry = flag.Bool("rm-try", false, "remove Try prefix from errors")
2223
)
2324

2425
func init() {
2526
// highlight that this is before flag.Parse to allow it to work properly.
2627
err2.SetLogTracer(os.Stderr) // for import
2728
err2.SetLogTracer(nil)
28-
29-
// select which one you want to play with
30-
err2.SetFormatter(formatter.DecamelAndRmTryPrefix)
31-
// err2.SetFormatter(formatter.Decamel)
3229
}
3330

3431
func main() {
@@ -37,6 +34,12 @@ func main() {
3734

3835
flag.Parse()
3936

37+
if *rmTry {
38+
// select which one you want to play with
39+
err2.SetFormatter(formatter.DecamelAndRmTryPrefix)
40+
// err2.SetFormatter(formatter.Decamel)
41+
}
42+
4043
switch *mode {
4144
case "db":
4245
doDBMain()

0 commit comments

Comments
 (0)