summaryrefslogtreecommitdiff
path: root/model
diff options
context:
space:
mode:
authorKevin Chabowski <kevin@kch42.de>2013-09-14 12:42:30 +0200
committerKevin Chabowski <kevin@kch42.de>2013-09-14 12:42:30 +0200
commit33c32f1e026482d60de635656a53de723114fcb7 (patch)
tree95a828ed57cd32769b2586143342caae15017025 /model
parentd81063cc7986234a6b6276560fbd054a538d25cb (diff)
downloadmailremind-33c32f1e026482d60de635656a53de723114fcb7.tar.gz
mailremind-33c32f1e026482d60de635656a53de723114fcb7.tar.bz2
mailremind-33c32f1e026482d60de635656a53de723114fcb7.zip
checkjobs (was checkmails) now recovers from panics
Diffstat (limited to 'model')
-rw-r--r--model/mysql/jobs.go5
1 files changed, 3 insertions, 2 deletions
diff --git a/model/mysql/jobs.go b/model/mysql/jobs.go
index 2695d50..1b9598b 100644
--- a/model/mysql/jobs.go
+++ b/model/mysql/jobs.go
@@ -134,7 +134,8 @@ func (j *Job) Next() time.Time { return j.next }
func (j *Job) User() model.User {
u, err := j.con.UserByID(j.user)
if err != nil {
- // TODO: Should we really panic here? If yes, we need to recover panics!
+ // We panic here, since the user must exist, if the job is there.
+ // Since http handlers and the job handler do recover from panics, this should be okay.
panic(fmt.Errorf("Could not get user (%d) of Job %d: %s", j.user, j.id, err))
}
@@ -185,7 +186,7 @@ func (j *Job) Delete() error {
func (con *MySQLDBCon) JobsBefore(t time.Time) (jobs []model.Job) {
rows, err := con.stmt[qJobsBefore].Query(t.Unix())
if err != nil {
- log.Fatalf("Could not get jobs before %s: %s", t, err) // TODO: Really fatal?
+ log.Fatalf("Could not get jobs before %s: %s", t, err)
}
for rows.Next() {