Skip to content

Commit

Permalink
Use constant for ProjectAlreadyExistsErr
Browse files Browse the repository at this point in the history
  • Loading branch information
ahmedwaleedmalik committed Apr 1, 2021
1 parent 56b47ae commit b17ca20
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion controllers/project_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ const (
// TODO: Check if this is required in our case
// defaultRequeueTime = 60 * time.Second
ProjectFinalizer string = "jiraservicedesk.stakater.com/project"
ProjectAlreadyExistsErr string = "A project with that name already exists."
)

// ProjectReconciler reconciles a Project object
Expand Down Expand Up @@ -136,7 +137,7 @@ func (r *ProjectReconciler) handleCreate(req ctrl.Request, instance *jiraservice
projectId, err := r.JiraServiceDeskClient.CreateProject(project)

// If project already exists then reconstruct status
if err != nil && strings.Contains(err.Error(), "A project with that name already exists.") {
if err != nil && strings.Contains(err.Error(), ProjectAlreadyExistsErr) {
existingProject, err := r.JiraServiceDeskClient.GetProjectByIdentifier(instance.Spec.Key)
if err != nil {
return reconcilerUtil.ManageError(r.Client, instance, err, false)
Expand Down

0 comments on commit b17ca20

Please sign in to comment.