Skip to content

Commit

Permalink
Fix validation
Browse files Browse the repository at this point in the history
  • Loading branch information
Maelkum committed Nov 14, 2024
1 parent e679f31 commit 79be8e6
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions models/execute/request.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@ func (r Request) Valid() error {
var err *multierror.Error

if r.FunctionID == "" {
multierror.Append(err, errors.New("function ID is required"))
err = multierror.Append(err, errors.New("function ID is required"))
}

if r.Method == "" {
multierror.Append(err, errors.New("method is required"))
err = multierror.Append(err, errors.New("method is required"))
}

return err.ErrorOrNil()
Expand Down
4 changes: 2 additions & 2 deletions node/process.go
Original file line number Diff line number Diff line change
Expand Up @@ -146,12 +146,12 @@ func handleMessage[T blockless.Message](ctx context.Context, from peer.ID, paylo

// If the message provides a validation mechanism - use it.
type validator interface {
Validate() error
Valid() error
}

vmsg, ok := any(msg).(validator)
if ok {
err = vmsg.Validate()
err = vmsg.Valid()
if err != nil {
return fmt.Errorf("rejecting message that failed validation: %w", err)
}
Expand Down

0 comments on commit 79be8e6

Please sign in to comment.