Skip to content

Commit

Permalink
improve error handling for gitops and recreate gitops resources if th…
Browse files Browse the repository at this point in the history
…ey are deleted (#561)

Signed-off-by: Mirko Teodorovic <[email protected]>
  • Loading branch information
mteodor authored Sep 3, 2024
1 parent fe6034a commit ce3cdf1
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 0 deletions.
12 changes: 12 additions & 0 deletions harness/nextgen/api_applications.go
Original file line number Diff line number Diff line change
Expand Up @@ -634,6 +634,18 @@ func (a *ApplicationsApiService) AgentApplicationServiceGet(ctx context.Context,
body: localVarBody,
error: localVarHttpResponse.Status,
}

if localVarHttpResponse.StatusCode >= 400 {
var v GatewayruntimeError
err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type"))
if err != nil {
newErr.error = err.Error()
return localVarReturnValue, localVarHttpResponse, newErr
}
newErr.model = v
return localVarReturnValue, localVarHttpResponse, newErr
}

if localVarHttpResponse.StatusCode == 200 {
var v Servicev1Application
err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type"))
Expand Down
12 changes: 12 additions & 0 deletions harness/nextgen/api_clusters.go
Original file line number Diff line number Diff line change
Expand Up @@ -473,6 +473,18 @@ func (a *ClustersApiService) AgentClusterServiceGet(ctx context.Context, agentId
body: localVarBody,
error: localVarHttpResponse.Status,
}

if localVarHttpResponse.StatusCode >= 400 {
var v GatewayruntimeError
err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type"))
if err != nil {
newErr.error = err.Error()
return localVarReturnValue, localVarHttpResponse, newErr
}
newErr.model = v
return localVarReturnValue, localVarHttpResponse, newErr
}

if localVarHttpResponse.StatusCode == 200 {
var v Servicev1Cluster
err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type"))
Expand Down
12 changes: 12 additions & 0 deletions harness/nextgen/api_repositories.go
Original file line number Diff line number Diff line change
Expand Up @@ -458,6 +458,18 @@ func (a *RepositoriesApiService) AgentRepositoryServiceGet(ctx context.Context,
body: localVarBody,
error: localVarHttpResponse.Status,
}

if localVarHttpResponse.StatusCode >= 400 {
var v GatewayruntimeError
err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type"))
if err != nil {
newErr.error = err.Error()
return localVarReturnValue, localVarHttpResponse, newErr
}
newErr.model = v
return localVarReturnValue, localVarHttpResponse, newErr
}

if localVarHttpResponse.StatusCode == 200 {
var v Servicev1Repository
err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type"))
Expand Down

0 comments on commit ce3cdf1

Please sign in to comment.