From 2566ec8eaac176f98c2b4eeaad1de71590a6bb37 Mon Sep 17 00:00:00 2001 From: qowevisa Date: Sun, 1 Dec 2024 13:22:41 +0200 Subject: [PATCH] Add CANT_FIND_CURRENCY error to db.go and fix problem when initCurrencies returned CANT_FIND_METRIC --- db/db.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/db/db.go b/db/db.go index 9aedc9d..597b0f6 100644 --- a/db/db.go +++ b/db/db.go @@ -77,7 +77,8 @@ func Connect() *gorm.DB { } var ( - CANT_FIND_METRIC = errors.New("Can't find proper metrics in database") + CANT_FIND_METRIC = errors.New("Can't find proper metrics in database") + CANT_FIND_CURRENCY = errors.New("Can't find proper currencies in database") ) func checkSeededValues[T Identifiable](whatToCheck []*T, errorIfNotFound error, tx *gorm.DB) error { @@ -127,7 +128,7 @@ func initCurrencies(tx *gorm.DB) error { {Name: "Kazakhstani Tenge", Symbol: "₸", ISOName: "KZT"}, {Name: "Chinese Yuan", Symbol: "¥", ISOName: "CNY"}, } - return checkSeededValues(currsThatNeeded, CANT_FIND_METRIC, tx) + return checkSeededValues(currsThatNeeded, CANT_FIND_CURRENCY, tx) } func initStateOfDb(tx *gorm.DB) error {