mirror of
https://github.com/Theodor-Springmann-Stiftung/musenalm.git
synced 2025-10-29 09:15:33 +00:00
Introduced templating and views
This commit is contained in:
43
helpers/errors.go
Normal file
43
helpers/errors.go
Normal file
@@ -0,0 +1,43 @@
|
||||
package helpers
|
||||
|
||||
import (
|
||||
"os"
|
||||
|
||||
"github.com/Theodor-Springmann-Stiftung/kgpz_web/helpers/logging"
|
||||
)
|
||||
|
||||
func Assert(err error, msg ...string) {
|
||||
if err == nil {
|
||||
return
|
||||
}
|
||||
|
||||
logging.Error(err, msg...)
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
func AssertNonNil(obj interface{}, msg ...string) {
|
||||
if obj != nil {
|
||||
return
|
||||
}
|
||||
|
||||
logging.Error(nil, msg...)
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
func AssertNil(obj interface{}, msg ...string) {
|
||||
if obj == nil {
|
||||
return
|
||||
}
|
||||
|
||||
logging.Error(nil, msg...)
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
func AssertStr(str string, msg ...string) {
|
||||
if str != "" {
|
||||
return
|
||||
}
|
||||
|
||||
logging.Error(nil, msg...)
|
||||
os.Exit(1)
|
||||
}
|
||||
Reference in New Issue
Block a user