rschmukler/agenda — pull request #48 by alexanderbeletsky (2014-04-06 09:31:15+00:00)
Title: Fail the job if repeat interval is wrong

I've scheduled my few jobs in that way,

```js
// emails
agenda.schedule('friday at 4pm', 'send weekly pulse developers').repeatEvery('week').save();
agenda.schedule('saturday at 6am', 'send weekly pulse users').repeatEvery('week').save();
```

It worked fine, but next week I've noticed that jobs didn't start and no emails were sent. I've checked db and noticed that `nextRunAt` were set to `NaN` for both of jobs. I wrote the test that cleanly reproduce the situation, but after debugging it was clear it's not a bug in `agenga` or `human-interval`.. it just don't understand `week` and in my code it should be changed to `1 week` (maybe `human-interval` should be changed a little to accept `week` as well)..

But I wasn't completely happy with situation. It will be better if job fail in case of `nextRunAt` cannot be calculated. So, in db I will see `failReason` and spend less time for debugging.

I pack up PR that does that.