Skip to content

Commit

Permalink
Rename JobRunnerError to RecurringScheduleJobError
Browse files Browse the repository at this point in the history
  • Loading branch information
rupurt committed Oct 2, 2018
1 parent 2ff420d commit fb4f2a7
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
10 changes: 5 additions & 5 deletions services/job_runner.go
Original file line number Diff line number Diff line change
Expand Up @@ -169,12 +169,12 @@ func BuildRun(
) (models.JobRun, error) {
now := store.Clock.Now()
if !job.Started(now) {
return models.JobRun{}, JobRunnerError{
return models.JobRun{}, RecurringScheduleJobError{
msg: fmt.Sprintf("Job runner: Job %v unstarted: %v before job's start time %v", job.ID, now, job.EndAt),
}
}
if job.Ended(now) {
return models.JobRun{}, JobRunnerError{
return models.JobRun{}, RecurringScheduleJobError{
msg: fmt.Sprintf("Job runner: Job %v ended: %v past job's end time %v", job.ID, now, job.EndAt),
}
}
Expand Down Expand Up @@ -326,12 +326,12 @@ func wrapError(run models.JobRun, err error) error {
return nil
}

// JobRunnerError contains the field for the error message.
type JobRunnerError struct {
// RecurringScheduleJobError contains the field for the error message.
type RecurringScheduleJobError struct {
msg string
}

// Error returns the error message for the run.
func (err JobRunnerError) Error() string {
func (err RecurringScheduleJobError) Error() string {
return err.msg
}
6 changes: 3 additions & 3 deletions services/scheduler.go
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ func (r *Recurring) AddJob(job models.JobSpec) {
return
}
r.store.RunChannel.Send(run.ID, input, nil)
} else if !expectedRecurringError(err) {
} else if !expectedRecurringScheduleJobError(err) {
logger.Errorw(err.Error())
}
})
Expand Down Expand Up @@ -204,9 +204,9 @@ func (ot *OneTime) RunJobAt(initr models.Initiator, job models.JobSpec) {
}
}

func expectedRecurringError(err error) bool {
func expectedRecurringScheduleJobError(err error) bool {
switch err.(type) {
case JobRunnerError:
case RecurringScheduleJobError:
return true
default:
return false
Expand Down

0 comments on commit fb4f2a7

Please sign in to comment.