Skip to content

Commit

Permalink
Panic when Invalid Struct is Registered (#361)
Browse files Browse the repository at this point in the history
Without this, an invalid struct can be partially registered in tests or
in workers, which can lead to weird failure when activities are missing
but unknown as to why they are missing.
  • Loading branch information
sjmtan authored Feb 11, 2021
1 parent 540ca80 commit a97e3b2
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion internal/internal_worker.go
Original file line number Diff line number Diff line change
Expand Up @@ -531,7 +531,10 @@ func (r *registry) RegisterActivityWithOptions(
// Validate that it is a function
fnType := reflect.TypeOf(af)
if fnType.Kind() == reflect.Ptr && fnType.Elem().Kind() == reflect.Struct {
_ = r.registerActivityStructWithOptions(af, options)
registerErr := r.registerActivityStructWithOptions(af, options)
if registerErr != nil {
panic(registerErr)
}
return
}
if err := validateFnFormat(fnType, false); err != nil {
Expand Down

0 comments on commit a97e3b2

Please sign in to comment.