diff --git a/helpers/component_info.json b/helpers/component_info.json index 771e955d4..594de9386 100644 --- a/helpers/component_info.json +++ b/helpers/component_info.json @@ -1,5 +1,5 @@ { "name": "meshery-istio", "type": "adapter", - "next_error_code": 1033 + "next_error_code": 1034 } \ No newline at end of file diff --git a/istio/error.go b/istio/error.go index 09ffd9161..35456580d 100644 --- a/istio/error.go +++ b/istio/error.go @@ -123,7 +123,10 @@ var ( // ErrLoadNamespaceCode implies error while finding namespace ErrLoadNamespaceCode = "1032" + // ErrLoadNamespaceCode implies error while finding namespace + ErrFetchIstioVersionsCode = "1032" + ErrFetchIstioVersions = errors.New(ErrFetchIstioVersionsCode, errors.Alert, []string{"could not get any istio versions"}, []string{"versions for istio could not be fetched"}, []string{"could not reach github.com/istio/istio/releases", "no versions could be fetched from istio release page"}, []string{"make sure adapter is reachable to github"}) // ErrOpInvalid represents the errors which are generated // when an invalid operation is requested ErrOpInvalid = errors.New(ErrOpInvalidCode, errors.Alert, []string{"Invalid operation"}, []string{"Istio adapter received an invalid operation from the meshey server"}, []string{"The operation is not supported by the adapter", "Invalid operation name"}, []string{"Check if the operation name is valid and supported by the adapter"}) diff --git a/istio/istio.go b/istio/istio.go index cc8d589bc..433271016 100644 --- a/istio/istio.go +++ b/istio/istio.go @@ -62,7 +62,7 @@ func (istio *Istio) ApplyOperation(ctx context.Context, opReq adapter.OperationR var err error var stat, version string if len(operations[opReq.OperationName].Versions) == 0 { - err = fmt.Errorf("no version found for " + internalconfig.IstioOperation) + err = ErrFetchIstioVersions } else { version = string(operations[opReq.OperationName].Versions[len(operations[opReq.OperationName].Versions)-1]) stat, err = hh.installIstio(opReq.IsDeleteOperation, false, version, opReq.Namespace, "default", kubeConfigs)