ostree: rename errors and introduce ParameterComboError

Shorter and clearer error types.
- InvalidParameterError is now RefError.  It is returned when a ref (the
  new ref or the parent ref) is invalid.
- The ResolveRefError is not renamed.  It is returned when a ref can't
  be resolved (e.g., ref not found at URL).

New error type ParameterComboError.  It is returned when a parent ref is
specified but no URL, which is an invalid parameter combination.
This commit is contained in:
Achilleas Koutsou 2022-01-18 21:22:43 +01:00 committed by Ondřej Budai
parent 36d8cd1dd2
commit 9e0af86775
3 changed files with 21 additions and 9 deletions

View file

@ -286,7 +286,7 @@ func (h *apiHandlers) PostCompose(ctx echo.Context) error {
}
if imageOptions.OSTree, err = ostree.ResolveParams(ostreeOptions, imageType.OSTreeRef()); err != nil {
switch v := err.(type) {
case ostree.InvalidParameterError:
case ostree.RefError:
return HTTPError(ErrorInvalidOSTreeRef)
case ostree.ResolveRefError:
return HTTPErrorWithInternal(ErrorInvalidOSTreeRepo, v)