Skip to content

Commit

Permalink
collect errors cleanly
Browse files Browse the repository at this point in the history
  • Loading branch information
anastasiamac committed Apr 2, 2019
1 parent 9844a63 commit 45f0019
Show file tree
Hide file tree
Showing 10 changed files with 388 additions and 353 deletions.
4 changes: 4 additions & 0 deletions apiserver/facades/client/application/application.go
Original file line number Diff line number Diff line change
Expand Up @@ -1377,6 +1377,8 @@ func (api *APIBase) DestroyUnit(args params.DestroyUnitsParams) (params.DestroyU
// TODO (anastasiamac 2019-03-29) we want to return errors and info when forced..
// maybe always, so that we can report how many errors we are getting/got.
// At the moment, this only returns the intent not the actual result.
// However, there is a provision for this functionality for the near-future: destroy operation itself
// contains Errors that have been encountered during its application.
return &info, nil
}
results := make([]params.DestroyUnitResult, len(args.Units))
Expand Down Expand Up @@ -1506,6 +1508,8 @@ func (api *APIBase) DestroyApplication(args params.DestroyApplicationsParams) (p
// TODO (anastasiamac 2019-03-29) we want to return errors and info when forced..
// maybe always, so that we can report how many errors we are getting/got.
// At the moment, this only returns the intent not the actual result.
// However, there is a provision for this functionality for the near-future: destroy operation itself
// contains Errors that have been encountered during its application.
return &info, nil
}
results := make([]params.DestroyApplicationResult, len(args.Applications))
Expand Down
6 changes: 6 additions & 0 deletions apiserver/params/params.go
Original file line number Diff line number Diff line change
Expand Up @@ -414,6 +414,12 @@ type DestroyUnitParams struct {
// Force controls whether or not the destruction of an application
// will be forced, i.e. ignore operational errors.
Force bool

// Errors contains errors encountered while applying this operation.
// Generally, these are non-fatal errors that have been encountered
// during, say, force. They may not have prevented the operation from being
// aborted but the user might still want to know about them.
Errors []error
}

// Creds holds credentials for identifying an entity.
Expand Down
Loading

0 comments on commit 45f0019

Please sign in to comment.