dapr / dapr/go-sdk

How to throw error correctly in actor method?

Open
#452 1 comment 0 reactions 0 assignees View on GitHub
bug
Dominant language
Go
Stars
479
Forks
187
PR merge metrics
No merged PRs in 30d

Description

I have an actor within following method
```go
func (t *TestActor) Invoke(ctx context.Context, req string) (string, error) {
return "", errors.New("Custom Message")
}
```
And I invoke the actor like this
```go
ctx, _ = context.WithTimeout(ctx, time.Second*15)
rsp, err := myActor.Invoke(ctx, "laurence")
if err != nil {
panic(err)
}
fmt.Println("get invoke result = ", rsp)
```
It should always go `panic(err)`, but the error shown is always "panic: error invoking binding testActorType/ActorImplID5121f5e3-bb26-4362-a199-e20ec9ebd5d5: rpc error: code = Internal desc = error invoke actor method: rpc error: code = Internal desc = error invoke actor method: error from actor service: "

Please advise..., also how to customize the grpc error code? now its always "Internal".

Contributor guide

Open the contributing guide

Research direction

Start with TestActor.Invoke and the myActor.Invoke call shown in the issue, then trace how the actor RPC error is propagated and mapped to gRPC status codes. Confirm whether the custom message and status code are preserved or lost; done means documenting the supported behavior or identifying a reproducible SDK change needed to preserve or customize them.

Written by the indexing model from the issue text.

Assessment

Tech stack
go, grpc
Domain
backend, distributed-systems
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.