diff --git a/32-platform/sportsstore/store.db b/32-platform/sportsstore/store.db index 597e2f4..2904d43 100644 Binary files a/32-platform/sportsstore/store.db and b/32-platform/sportsstore/store.db differ diff --git a/32-platform/sportsstore/store/category_handler.go b/32-platform/sportsstore/store/category_handler.go index c32c4ac..14621be 100644 --- a/32-platform/sportsstore/store/category_handler.go +++ b/32-platform/sportsstore/store/category_handler.go @@ -27,7 +27,14 @@ func (handler CategoryHandler) GetButtons(selected int) actionresults.ActionResu func (handler CategoryHandler) createCategoryUrlFunction() func(int) string { return func(category int) string { - url, _ := handler.URLGenerator.GenerateUrl(ProductHandler.GetProducts, category, 1) - return url + return mustGenerateUrl(handler.URLGenerator, ProductHandler.GetProducts, category, 1) } } + +func mustGenerateUrl(generator handing.URLGenerator, method interface{}, data ...interface{}) string { + url, err := generator.GenerateUrl(method, data...) + if err != nil { + panic(err) + } + return url +} diff --git a/32-platform/sportsstore/store/product_handler.go b/32-platform/sportsstore/store/product_handler.go index 9ddaf56..dda3d71 100644 --- a/32-platform/sportsstore/store/product_handler.go +++ b/32-platform/sportsstore/store/product_handler.go @@ -42,8 +42,7 @@ func (handler ProductHandler) GetProducts(category, page int) actionresults.Acti func (handler ProductHandler) createPageUrlFunction(category int) func(int) string { return func(page int) string { - url, _ := handler.URLGenerator.GenerateUrl(ProductHandler.GetProducts, category, page) - return url + return mustGenerateUrl(handler.URLGenerator, category, page) } } @@ -54,11 +53,3 @@ func (handler ProductHandler) generatePageNumbers(pageCount int) (pages []int) { } return } - -func mustGenerateUrl(generator handing.URLGenerator, method interface{}, data ...interface{}) string { - url, err := generator.GenerateUrl(method, data...) - if err != nil { - panic(err) - } - return url -}