129
// RegisterOperation registers a named operation with this service processor.
130
// Returns an error if an operation with the same name is already registered.
131
>
func (p *NexusServiceProcessor) RegisterOperation(name string, op RegisterableNexusOperationProcessor) error {
nexus_operation_processor.go
132
>
if _, exists := p.operations[name]; exists {
133
return fmt.Errorf("operation %q already registered", name)
134
}
136
>
return nil
137
}
138
139
// MustRegisterOperation registers a named operation and panics if registration fails.
140
>
func (p *NexusServiceProcessor) MustRegisterOperation(name string, op RegisterableNexusOperationProcessor) {
nexus_operation_processor.go
141
>
if err := p.RegisterOperation(name, op); err != nil {
142
// nolint:forbidigo // Panic is acceptable here for Must-style method.
143
panic(err)