@@ -10,12 +10,16 @@ import (
1010 mapset "github.com/deckarep/golang-set/v2"
1111 "github.com/nats-io/nats.go/jetstream"
1212 ants "github.com/panjf2000/ants/v2"
13+ "github.com/rs/zerolog"
14+ "github.com/samber/lo"
15+ "google.golang.org/protobuf/proto"
16+ "google.golang.org/protobuf/types/known/anypb"
17+
1318 "github.com/pubgo/funk/v2/assert"
1419 "github.com/pubgo/funk/v2/buildinfo/version"
1520 "github.com/pubgo/funk/v2/component/lifecycle"
1621 "github.com/pubgo/funk/v2/component/natsclient"
1722 "github.com/pubgo/funk/v2/errors"
18- "github.com/pubgo/funk/v2/internal/anyhow"
1923 "github.com/pubgo/funk/v2/log"
2024 "github.com/pubgo/funk/v2/log/logfields"
2125 cloudeventpb "github.com/pubgo/funk/v2/proto/cloudevent"
@@ -24,10 +28,6 @@ import (
2428 "github.com/pubgo/funk/v2/stack"
2529 "github.com/pubgo/funk/v2/try"
2630 "github.com/pubgo/funk/v2/typex"
27- "github.com/rs/zerolog"
28- "github.com/samber/lo"
29- "google.golang.org/protobuf/proto"
30- "google.golang.org/protobuf/types/known/anypb"
3131)
3232
3333type Params struct {
@@ -346,7 +346,7 @@ func (c *Client) doErrHandler(streamName, consumerName string) jetstream.PullCon
346346 })
347347}
348348
349- func (c * Client ) doHandler (meta * jetstream.MsgMetadata , msg jetstream.Msg , job * jobEventHandler , cfg * JobEventConfig ) (gErr anyhow .Error ) {
349+ func (c * Client ) doHandler (meta * jetstream.MsgMetadata , msg jetstream.Msg , job * jobEventHandler , cfg * JobEventConfig ) (gErr result .Error ) {
350350 var timeout = lo .FromPtr (cfg .Timeout )
351351 ctx , cancel := context .WithTimeout (context .Background (), timeout )
352352 defer cancel ()
@@ -388,31 +388,31 @@ func (c *Client) doHandler(meta *jetstream.MsgMetadata, msg jetstream.Msg, job *
388388 }()
389389
390390 var pb anypb.Any
391- err := anyhow .ErrOf (proto .Unmarshal (msg .Data (), & pb )).
391+ err := result .ErrOf (proto .Unmarshal (msg .Data (), & pb )).
392392 Map (func (err error ) error {
393393 return errors .WrapTag (err ,
394394 errors .T ("msg" , "failed to unmarshal stream msg data to any proto" ),
395395 errors .T ("args" , string (msg .Data ())),
396396 )
397397 })
398- if err .CatchErr (& gErr ) {
398+ if err .Catch (& gErr ) {
399399 return
400400 }
401401 args = & pb
402402
403- dst := anyhow .Wrap (anypb .UnmarshalNew (args .(* anypb.Any ), proto.UnmarshalOptions {})).
403+ dst := result .Wrap (anypb .UnmarshalNew (args .(* anypb.Any ), proto.UnmarshalOptions {})).
404404 MapErr (func (err error ) error {
405405 return errors .WrapTag (err ,
406406 errors .T ("msg" , "failed to unmarshal any proto to proto msg" ),
407407 errors .T ("args" , args ),
408408 )
409409 })
410- if dst .CatchErr (& gErr ) {
410+ if dst .Catch (& gErr ) {
411411 return
412412 }
413413
414414 ctx = createCtxWithContext (ctx , msgCtx )
415- err = anyhow .ErrOf (job .handler (ctx , dst .GetValue ())).
415+ err = result .ErrOf (job .handler (ctx , dst .GetValue ())).
416416 Map (func (err error ) error {
417417 return errors .WrapTag (err ,
418418 errors .T ("msg" , "failed to do cloud job handler" ),
0 commit comments