Skip to content

Commit

Permalink
Fix #607 Update data agreement endpoint to return 400 status code if …
Browse files Browse the repository at this point in the history
…not present
  • Loading branch information
albinpa authored and georgepadayatti committed Jan 4, 2024
1 parent 4cd6b2c commit 0b0ff0d
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ func ConfigReadDataAgreement(w http.ResponseWriter, r *http.Request) {
da, err := daRepo.Get(dataAgreementId)
if err != nil {
m := fmt.Sprintf("Failed to fetch data agreement: %v", dataAgreementId)
common.HandleErrorV2(w, http.StatusInternalServerError, m, err)
common.HandleErrorV2(w, http.StatusBadRequest, m, err)
return
}

Expand All @@ -55,7 +55,7 @@ func ConfigReadDataAgreement(w http.ResponseWriter, r *http.Request) {
rev, err = revision.GetByRevisionId(revisionId)
if err != nil {
m := fmt.Sprintf("Failed to fetch revision: %v", dataAgreementId)
common.HandleErrorV2(w, http.StatusInternalServerError, m, err)
common.HandleErrorV2(w, http.StatusBadRequest, m, err)
return
}

Expand All @@ -67,7 +67,7 @@ func ConfigReadDataAgreement(w http.ResponseWriter, r *http.Request) {
rev, err = revision.GetLatestByDataAgreementId(dataAgreementId)
if err != nil {
m := fmt.Sprintf("Failed to fetch revision: %v", dataAgreementId)
common.HandleErrorV2(w, http.StatusInternalServerError, m, err)
common.HandleErrorV2(w, http.StatusBadRequest, m, err)
return
}

Expand All @@ -77,7 +77,7 @@ func ConfigReadDataAgreement(w http.ResponseWriter, r *http.Request) {
rev, err = revision.CreateRevisionForDraftDataAgreement(da, orgAdminId)
if err != nil {
m := "Failed to create revision in run time"
common.HandleErrorV2(w, http.StatusInternalServerError, m, err)
common.HandleErrorV2(w, http.StatusBadRequest, m, err)
return
}

Expand Down

0 comments on commit 0b0ff0d

Please sign in to comment.