mirror of
https://gitlab.com/pulsechaincom/prysm-pulse.git
synced 2025-01-12 04:30:04 +00:00
Expand Validator Input Errors (#8090)
The reason of why a validator input was failing was very generic, this allows the actual implementation to state why it failed by passing the exception forward. Co-authored-by: Raul Jordan <raul@prysmaticlabs.com>
This commit is contained in:
parent
99b3835f19
commit
2e18df642d
@ -44,7 +44,7 @@ func (s *Server) Signup(ctx context.Context, req *pb.AuthRequest) (*pb.AuthRespo
|
||||
// We check the strength of the password to ensure it is high-entropy,
|
||||
// has the required character count, and contains only unicode characters.
|
||||
if err := promptutil.ValidatePasswordInput(req.Password); err != nil {
|
||||
return nil, status.Error(codes.InvalidArgument, "Could not validate RPC password input")
|
||||
return nil, status.Errorf(codes.InvalidArgument, "Could not validate RPC password input: %v", err)
|
||||
}
|
||||
hasDir, err := fileutil.HasDir(walletDir)
|
||||
if err != nil {
|
||||
@ -68,7 +68,7 @@ func (s *Server) Login(ctx context.Context, req *pb.AuthRequest) (*pb.AuthRespon
|
||||
// We check the strength of the password to ensure it is high-entropy,
|
||||
// has the required character count, and contains only unicode characters.
|
||||
if err := promptutil.ValidatePasswordInput(req.Password); err != nil {
|
||||
return nil, status.Error(codes.InvalidArgument, "Could not validate RPC password input")
|
||||
return nil, status.Errorf(codes.InvalidArgument, "Could not validate RPC password input: %v", err)
|
||||
}
|
||||
hashedPasswordPath := filepath.Join(walletDir, HashedRPCPassword)
|
||||
if !fileutil.FileExists(hashedPasswordPath) {
|
||||
@ -142,7 +142,7 @@ func (s *Server) ChangePassword(ctx context.Context, req *pb.ChangePasswordReque
|
||||
return nil, status.Error(codes.InvalidArgument, "Password does not match confirmation")
|
||||
}
|
||||
if err := promptutil.ValidatePasswordInput(req.Password); err != nil {
|
||||
return nil, status.Error(codes.InvalidArgument, "Could not validate password input")
|
||||
return nil, status.Errorf(codes.InvalidArgument, "Could not validate password input: %v", err)
|
||||
}
|
||||
// Write the new password hash to disk.
|
||||
if err := s.SaveHashedPassword(req.Password); err != nil {
|
||||
|
Loading…
Reference in New Issue
Block a user