Cleanup pass to remove refactoring-related artifacts and references
This commit is contained in:
@@ -22,8 +22,7 @@ const (
|
||||
)
|
||||
|
||||
const (
|
||||
ReasonUnsupportedModule = "unsupported_module"
|
||||
ReasonUnimplementedModule = "unimplemented_module"
|
||||
ReasonUnsupportedModule = "unsupported_module"
|
||||
)
|
||||
|
||||
var knownModuleKeys = map[string]struct{}{
|
||||
@@ -66,8 +65,7 @@ type Factory struct {
|
||||
constructors map[string]Constructor
|
||||
}
|
||||
|
||||
// NewFactory creates a production registry scaffold with known module keys but
|
||||
// no real module constructors registered yet.
|
||||
// NewFactory creates a production module registry.
|
||||
func NewFactory(deps Dependencies) *Factory {
|
||||
factory := &Factory{
|
||||
deps: deps,
|
||||
@@ -133,7 +131,7 @@ func (f *Factory) ModuleForSpec(spec contracts.ModuleRunSpec) (contracts.Transcr
|
||||
|
||||
constructor, ok := f.constructors[key]
|
||||
if !ok || constructor == nil {
|
||||
return nil, &UnimplementedModuleError{ModuleKey: key}
|
||||
return nil, fmt.Errorf("internal module registry error: constructor for module %q is not configured", key)
|
||||
}
|
||||
|
||||
module, err := constructor(context.Background(), ConstructRequest{
|
||||
@@ -170,17 +168,3 @@ func (e *UnsupportedModuleError) Error() string {
|
||||
func (e *UnsupportedModuleError) ReasonCode() string {
|
||||
return ReasonUnsupportedModule
|
||||
}
|
||||
|
||||
// UnimplementedModuleError indicates a known module key without constructor.
|
||||
type UnimplementedModuleError struct {
|
||||
ModuleKey string
|
||||
}
|
||||
|
||||
func (e *UnimplementedModuleError) Error() string {
|
||||
return fmt.Sprintf("module %q is recognized but not implemented", strings.TrimSpace(e.ModuleKey))
|
||||
}
|
||||
|
||||
// ReasonCode returns a stable reason code suitable for reporting.
|
||||
func (e *UnimplementedModuleError) ReasonCode() string {
|
||||
return ReasonUnimplementedModule
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user