app: pre-declare errors
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
leo 2023-05-04 16:38:15 +02:00
parent 38f72825e0
commit 9fd55dbc0b
Signed by: wanderer
SSH Key Fingerprint: SHA256:Dp8+iwKHSlrMEHzE3bJnPng70I7LEsa3IJXRH/U+idQ
2 changed files with 10 additions and 3 deletions

@ -2,7 +2,6 @@ package app
import (
"embed"
"errors"
"git.dotya.ml/mirre-mt/pcmt/app/settings"
"git.dotya.ml/mirre-mt/pcmt/ent"
@ -68,7 +67,7 @@ func (a *App) Init(s *settings.Settings, logger *slogging.Logger, dbclient *ent.
return nil
}
return errors.New("ErrAppAlreadyInitialised")
return ErrAppAlreadyInitialised
}
// E returns app's *echo.Echo instance.
@ -95,7 +94,7 @@ func (a *App) PrintConfiguration() {
return
}
panic(errors.New("somehow we got here with config unset - contact the developer"))
panic(ErrAppSettingsUnset)
}
func (a *App) SetSettings(s *settings.Settings) {

8
app/error.go Normal file

@ -0,0 +1,8 @@
package app
import "errors"
var (
ErrAppSettingsUnset = errors.New("somehow we got here with settings unset - contact the developer")
ErrAppAlreadyInitialised = errors.New("app was already initialised")
)