Skip to content

Commit

Permalink
Options validation
Browse files Browse the repository at this point in the history
Signed-off-by: Kimmo Lehto <[email protected]>
  • Loading branch information
kke committed Feb 19, 2024
1 parent 8c43287 commit 0cbcf82
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions options.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,14 @@ func (o *Options) Apply(opts ...Option) {
}
}

// Validate the options.
func (o *Options) Validate() error {
if o.connection == nil && o.connectionConfigurer == nil {
return fmt.Errorf("%w: no connection or connection configurer provided", protocol.ErrValidationFailed)
}
return nil
}

// Clone returns a copy of the Options struct.
func (o *Options) Clone() *Options {
return &Options{
Expand Down

0 comments on commit 0cbcf82

Please sign in to comment.