mirror of
https://github.com/jwetzell/showbridge-go.git
synced 2026-04-26 12:55:29 +00:00
udpate module and route config error objects for JSON
This commit is contained in:
@@ -10,9 +10,9 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
type ModuleError struct {
|
type ModuleError struct {
|
||||||
Index int
|
Index int `json:"index"`
|
||||||
Config config.ModuleConfig
|
Config config.ModuleConfig `json:"config"`
|
||||||
Error error
|
Error string `json:"error"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type Module interface {
|
type Module interface {
|
||||||
|
|||||||
@@ -13,9 +13,9 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
type RouteError struct {
|
type RouteError struct {
|
||||||
Index int
|
Index int `json:"index"`
|
||||||
Config config.RouteConfig
|
Config config.RouteConfig `json:"config"`
|
||||||
Error error
|
Error string `json:"error"`
|
||||||
}
|
}
|
||||||
type Route struct {
|
type Route struct {
|
||||||
input string
|
input string
|
||||||
|
|||||||
@@ -131,7 +131,7 @@ func NewRouter(config config.Config) (*Router, []module.ModuleError, []route.Rou
|
|||||||
moduleErrors = append(moduleErrors, module.ModuleError{
|
moduleErrors = append(moduleErrors, module.ModuleError{
|
||||||
Index: moduleIndex,
|
Index: moduleIndex,
|
||||||
Config: moduleDecl,
|
Config: moduleDecl,
|
||||||
Error: err,
|
Error: err.Error(),
|
||||||
})
|
})
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
@@ -148,7 +148,7 @@ func NewRouter(config config.Config) (*Router, []module.ModuleError, []route.Rou
|
|||||||
routeErrors = append(routeErrors, route.RouteError{
|
routeErrors = append(routeErrors, route.RouteError{
|
||||||
Index: routeIndex,
|
Index: routeIndex,
|
||||||
Config: routeDecl,
|
Config: routeDecl,
|
||||||
Error: err,
|
Error: err.Error(),
|
||||||
})
|
})
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -149,8 +149,8 @@ func TestNewRouterDuplicateModuleId(t *testing.T) {
|
|||||||
t.Fatalf("router should have returned exactly 1 module error, got: %d", len(moduleErrors))
|
t.Fatalf("router should have returned exactly 1 module error, got: %d", len(moduleErrors))
|
||||||
}
|
}
|
||||||
|
|
||||||
if moduleErrors[0].Error.Error() != "module id already exists" {
|
if moduleErrors[0].Error != "module id already exists" {
|
||||||
t.Fatalf("module error did not match expected, got: %s", moduleErrors[0].Error.Error())
|
t.Fatalf("module error did not match expected, got: %s", moduleErrors[0].Error)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -184,8 +184,8 @@ func TestNewRouterRouteWithUnknwonProcessor(t *testing.T) {
|
|||||||
t.Fatalf("router should have returned exactly 1 route error, got: %d", len(routeErrors))
|
t.Fatalf("router should have returned exactly 1 route error, got: %d", len(routeErrors))
|
||||||
}
|
}
|
||||||
|
|
||||||
if routeErrors[0].Error.Error() != "problem loading processor registration for processor type: asdfasdf" {
|
if routeErrors[0].Error != "problem loading processor registration for processor type: asdfasdf" {
|
||||||
t.Fatalf("route error did not match expected, got: %s", routeErrors[0].Error.Error())
|
t.Fatalf("route error did not match expected, got: %s", routeErrors[0].Error)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user