♻️ 错误处理优化

This commit is contained in:
naiba 2021-07-19 10:44:44 +08:00
parent aa5ac76442
commit 1e550c98ee
3 changed files with 5 additions and 12 deletions

View File

@ -1,7 +1,7 @@
<div align="center">
<img width="500" style="max-width:100%" src="resource/static/brand.png" title="哪吒监控">
<br><br>
<img src="https://img.shields.io/github/workflow/status/naiba/nezha/Dashboard%20image?label=Dash%20v0.9.6&logo=github&style=for-the-badge">&nbsp;<img src="https://img.shields.io/github/v/release/naiba/nezha?color=brightgreen&label=Agent&style=for-the-badge&logo=github">&nbsp;<img src="https://img.shields.io/github/workflow/status/naiba/nezha/Agent%20release?label=Agent%20CI&logo=github&style=for-the-badge">&nbsp;<img src="https://img.shields.io/badge/Installer-v0.6.4-brightgreen?style=for-the-badge&logo=linux">
<img src="https://img.shields.io/github/workflow/status/naiba/nezha/Dashboard%20image?label=Dash%20v0.9.7&logo=github&style=for-the-badge">&nbsp;<img src="https://img.shields.io/github/v/release/naiba/nezha?color=brightgreen&label=Agent&style=for-the-badge&logo=github">&nbsp;<img src="https://img.shields.io/github/workflow/status/naiba/nezha/Agent%20release?label=Agent%20CI&logo=github&style=for-the-badge">&nbsp;<img src="https://img.shields.io/badge/Installer-v0.6.4-brightgreen?style=for-the-badge&logo=linux">
<br>
<br>
<p>:trollface: <b>哪吒监控</b> 一站式轻监控轻运维系统。支持系统状态、HTTP(SSL 证书变更、即将到期、到期)、TCP、Ping 监控报警,命令批量执行和计划任务。</p>

View File

@ -268,7 +268,9 @@ func (ma *memberAPI) addOrEditCron(c *gin.Context) {
err = dao.DB.Save(&cr).Error
}
}
if err == nil {
cr.CronID, err = dao.Cron.AddFunc(cr.Scheduler, dao.CronTrigger(cr))
}
if err != nil {
c.JSON(http.StatusOK, model.Response{
Code: http.StatusBadRequest,
@ -277,15 +279,6 @@ func (ma *memberAPI) addOrEditCron(c *gin.Context) {
return
}
cr.CronID, err = dao.Cron.AddFunc(cr.Scheduler, dao.CronTrigger(cr))
if err != nil {
c.JSON(http.StatusOK, model.Response{
Code: http.StatusBadRequest,
Message: err.Error(),
})
return
}
dao.CronLock.Lock()
defer dao.CronLock.Unlock()
crOld := dao.Crons[cr.ID]

View File

@ -13,7 +13,7 @@ import (
pb "github.com/naiba/nezha/proto"
)
var Version = "v0.9.6" // !!记得修改 README 中的 badge 版本!!
var Version = "v0.9.7" // !!记得修改 README 中的 badge 版本!!
var (
Conf *model.Config