Skip to content

Commit

Permalink
feat: Updated core/method/manager.go
Browse files Browse the repository at this point in the history
  • Loading branch information
sweep-ai[bot] committed Dec 9, 2023
1 parent e2d8036 commit b4063bf
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion core/method/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,12 @@ var (
methods = make(map[string]Method)
)

func RegisterMethod(method Method) {
func RegisterMethod(method Method) error {
if _, ok := methods[strings.ToLower(method.Name())]; ok {
return fmt.Errorf("method already exists")
}
methods[strings.ToLower(method.Name())] = method
return nil
}

func GetMethod(name string) (method Method, ok bool) {
Expand Down

0 comments on commit b4063bf

Please sign in to comment.