Skip to content

Commit

Permalink
feat: Wrap the error with the proper error message
Browse files Browse the repository at this point in the history
Close: #3642
Signed-off-by: weichou <[email protected]>
  • Loading branch information
weichou1229 committed Aug 3, 2021
1 parent aaf2bd6 commit 3d5ecab
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion internal/support/scheduler/application/interval.go
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ func LoadIntervalToSchedulerManager(dic *di.Container) errors.EdgeX {
}
validateErr := common.Validate(dto)
if validateErr != nil {
return errors.NewCommonEdgeXWrapper(validateErr)
return errors.NewCommonEdgeX(errors.KindContractInvalid, fmt.Sprintf("validate pre-defined Interval %s from configuration failed", dto.Name), validateErr)
}
interval := dtos.ToIntervalModel(dto)
_, err := dbClient.IntervalByName(interval.Name)
Expand Down
2 changes: 1 addition & 1 deletion internal/support/scheduler/application/intervalaction.go
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ func LoadIntervalActionToSchedulerManager(dic *di.Container) errors.EdgeX {
}
validateErr := common.Validate(dto)
if validateErr != nil {
return errors.NewCommonEdgeXWrapper(validateErr)
return errors.NewCommonEdgeX(errors.KindContractInvalid, fmt.Sprintf("validate pre-defined IntervalAction %s from configuration failed", dto.Name), validateErr)
}
_, err := dbClient.IntervalByName(dto.IntervalName)
if err != nil {
Expand Down
4 changes: 2 additions & 2 deletions internal/support/scheduler/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,13 +59,13 @@ func (b *Bootstrap) BootstrapHandler(ctx context.Context, wg *sync.WaitGroup, _

err := application.LoadIntervalToSchedulerManager(dic)
if err != nil {
lc.Errorf("Failed to load interval to scheduler %v", err)
lc.Errorf("Failed to load interval to scheduler, %v", err)
return false
}

err = application.LoadIntervalActionToSchedulerManager(dic)
if err != nil {
lc.Errorf("Failed to load interval to scheduler %v", err)
lc.Errorf("Failed to load intervalAction to scheduler, %v", err)
return false
}

Expand Down

0 comments on commit 3d5ecab

Please sign in to comment.