friends/globals/get_user_data.go
Daniel López Guimaraes 8d8a05a7e2
Add missing error handling
Now database getters do error handling aswell, and in case of any error,
the NEX or GRPC method throws a proper error about it.

There are still some doubts on how to handle errors when a list of data
is processed, so for now skip that element on the list and continue.

Also add some constant errors to do better error handling.
2023-08-13 23:19:34 +01:00

20 lines
425 B
Go

package globals
import (
"context"
pb "github.com/PretendoNetwork/grpc-go/account"
"google.golang.org/grpc/metadata"
)
func GetUserData(pid uint32) (*pb.GetUserDataResponse, error) {
ctx := metadata.NewOutgoingContext(context.Background(), GRPCAccountCommonMetadata)
response, err := GRPCAccountClient.GetUserData(ctx, &pb.GetUserDataRequest{Pid: pid})
if err != nil {
return nil, err
}
return response, nil
}