mirror of
https://gitlab.com/pulsechaincom/prysm-pulse.git
synced 2024-12-25 21:07:18 +00:00
af2801f215
* initial implementation * get committee for epoch * test * fix failing test # Conflicts: # beacon-chain/rpc/prysm/v1alpha1/validator/assignments_test.go * combine function arguments * review feedback * use sync committee setter * fix failing test * fix build * remove bad test * refactor for single responsibilities * radek suggestions Co-authored-by: prylabs-bulldozer[bot] <58059840+prylabs-bulldozer[bot]@users.noreply.github.com> Co-authored-by: Raul Jordan <raul@prysmaticlabs.com>
19 lines
741 B
Go
19 lines
741 B
Go
package helpers
|
|
|
|
import (
|
|
"github.com/prysmaticlabs/prysm/beacon-chain/rpc/statefetcher"
|
|
"google.golang.org/grpc/codes"
|
|
"google.golang.org/grpc/status"
|
|
)
|
|
|
|
// PrepareStateFetchGRPCError returns an appropriate gRPC error based on the supplied argument.
|
|
// The argument error should be a result of fetching state.
|
|
func PrepareStateFetchGRPCError(err error) error {
|
|
if stateNotFoundErr, ok := err.(*statefetcher.StateNotFoundError); ok {
|
|
return status.Errorf(codes.NotFound, "State not found: %v", stateNotFoundErr)
|
|
} else if parseErr, ok := err.(*statefetcher.StateIdParseError); ok {
|
|
return status.Errorf(codes.InvalidArgument, "Invalid state ID: %v", parseErr)
|
|
}
|
|
return status.Errorf(codes.Internal, "Invalid state ID: %v", err)
|
|
}
|