增加定时任务 处理异常
This commit is contained in:
@@ -13,6 +13,21 @@ import (
|
||||
"time"
|
||||
)
|
||||
|
||||
func Exit(err any, str string) {
|
||||
switch arg := err.(type) {
|
||||
case error:
|
||||
if arg != nil {
|
||||
fmt.Println(str, arg.Error())
|
||||
os.Exit(1)
|
||||
}
|
||||
case bool:
|
||||
if arg {
|
||||
fmt.Println(str, err)
|
||||
os.Exit(1)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func GetReqPath(c *gin.Context) string {
|
||||
return c.Request.Method + " " + c.Request.URL.String()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user