Skip to content

Commit

Permalink
Rectified variable name for job not exist #938 (#1344)
Browse files Browse the repository at this point in the history
  • Loading branch information
subi9 authored May 20, 2022
1 parent cf16fe6 commit b1c13d8
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions api/pkg/dataflow/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,12 @@ package dataflow

import (
"encoding/json"
"errors"
"fmt"
"io/ioutil"
"net/http"
"os"
"strings"

"github.com/opensds/multi-cloud/api/pkg/common"
c "github.com/opensds/multi-cloud/api/pkg/context"
Expand All @@ -42,6 +45,7 @@ const (
backendService_K8S = "soda.multicloud.v1.backend"
s3Service_K8S = "soda.multicloud.v1.s3"
dataflowService_K8S = "soda.multicloud.v1.dataflow"
jobNotExist = "job not exist"
)

type APIService struct {
Expand Down Expand Up @@ -420,6 +424,11 @@ func (s *APIService) GetJob(request *restful.Request, response *restful.Response
ctx := common.InitCtxWithAuthInfo(request)
res, err := s.dataflowClient.GetJob(ctx, &dataflow.GetJobRequest{Id: id})
if err != nil {
if strings.Contains(err.Error(), jobNotExist) || strings.Contains(err.Error(), "invalid input to ObjectIdHex") {
msg := fmt.Sprintf("Job Id-%s does not exist in system", id)
response.WriteError(http.StatusNotFound, errors.New(msg))
return
}
response.WriteError(http.StatusInternalServerError, err)
return
}
Expand Down

0 comments on commit b1c13d8

Please sign in to comment.