mirror of
https://github.com/jwetzell/showbridge-go.git
synced 2026-04-26 21:05:30 +00:00
Merge pull request #47 from jwetzell/fix/module-id-required
add check to prevent empty module Id
This commit is contained in:
12
router.go
12
router.go
@@ -34,6 +34,18 @@ func NewRouter(config config.Config) (*Router, []module.ModuleError, []route.Rou
|
|||||||
|
|
||||||
for moduleIndex, moduleDecl := range config.Modules {
|
for moduleIndex, moduleDecl := range config.Modules {
|
||||||
|
|
||||||
|
if moduleDecl.Id == "" {
|
||||||
|
if moduleErrors == nil {
|
||||||
|
moduleErrors = []module.ModuleError{}
|
||||||
|
}
|
||||||
|
moduleErrors = append(moduleErrors, module.ModuleError{
|
||||||
|
Index: moduleIndex,
|
||||||
|
Config: moduleDecl,
|
||||||
|
Error: errors.New("module id cannot be empty"),
|
||||||
|
})
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
moduleInfo, ok := module.ModuleRegistry[moduleDecl.Type]
|
moduleInfo, ok := module.ModuleRegistry[moduleDecl.Type]
|
||||||
if !ok {
|
if !ok {
|
||||||
if moduleErrors == nil {
|
if moduleErrors == nil {
|
||||||
|
|||||||
Reference in New Issue
Block a user