File tree Expand file tree Collapse file tree 1 file changed +0
-24
lines changed Expand file tree Collapse file tree 1 file changed +0
-24
lines changed Original file line number Diff line number Diff line change @@ -3,33 +3,9 @@ package try
33import (
44 "github.com/pubgo/funk"
55 "github.com/pubgo/funk/errors"
6- "github.com/pubgo/funk/generic"
7- "github.com/pubgo/funk/result"
86 "github.com/pubgo/funk/stack"
97)
108
11- // Result
12- // Deprecated: use result.Try instead
13- func Result [T any ](fn func () result.Result [T ]) (g result.Result [T ]) {
14- if fn == nil {
15- g = g .WithErr (errors .WrapStack (errors .New ("[fn] is nil" )))
16- return
17- }
18-
19- defer func () {
20- if err := errors .Parse (recover ()); ! generic .IsNil (err ) {
21- g = g .WithErr (errors .WrapStack (err ))
22- }
23-
24- if g .IsErr () {
25- g = g .WithErr (errors .WrapKV (g .Err (), "fn_stack" , stack .CallerWithFunc (fn )))
26- }
27- }()
28-
29- g = fn ()
30- return
31- }
32-
339func WithErr (gErr * error , fn func () error ) {
3410 if fn == nil {
3511 * gErr = errors .WrapStack (errors .New ("[fn] is nil" ))
You can’t perform that action at this time.
0 commit comments