Skip to content

Commit

Permalink
Status Error type conversion handled
Browse files Browse the repository at this point in the history
Signed-off-by: rcmadhankumar <[email protected]>
  • Loading branch information
rcmadhankumar committed Oct 19, 2023
1 parent d4e6b7f commit eebebae
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions pkg/apiserver/registry/datapackaging/package_storage_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -152,10 +152,14 @@ func (t PackageTranslator) ToExternalWatcher(intObjWatcher watch.Interface, fiel
}

func (t PackageTranslator) ToExternalError(err error) error {
statusErr := err.(*errors.StatusError)
statusErr, isStatusError := err.(*errors.StatusError)
if !isStatusError {
return err
}

if statusErr.ErrStatus.Details.Kind == "internalpackages" && statusErr.ErrStatus.Details.Group == internalpkgingv1alpha1.SchemeGroupVersion.Group {
packageName, err := t.ToExternalName(statusErr.ErrStatus.Details.Name)
details := statusErr.ErrStatus.Details
if details.Kind == "internalpackages" && details.Group == internalpkgingv1alpha1.SchemeGroupVersion.Group {
packageName, err := t.ToExternalName(details.Name)
if err != nil {
return err
}
Expand Down

0 comments on commit eebebae

Please sign in to comment.