Skip to content

Commit

Permalink
improved error reporting and fix placeholder name
Browse files Browse the repository at this point in the history
These changes partially address issues brought up during code review. More
changes to come.

BACK-2500
  • Loading branch information
ewollesen committed Oct 24, 2023
1 parent 0f3bafb commit aca88cd
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
1 change: 1 addition & 0 deletions api/hydrophoneApi.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ const (
STATUS_ERR_FINDING_CLINIC = "Error finding the clinic"
STATUS_ERR_DECODING_CONFIRMATION = "Error decoding the confirmation"
STATUS_ERR_DECODING_CONTEXT = "Error decoding the confirmation context"
STATUS_ERR_VALIDATING_CONTEXT = "Error validating the confirmation context"
STATUS_ERR_CREATING_PATIENT = "Error creating patient"
STATUS_ERR_FINDING_PREVIEW = "Error finding the invite preview"
STATUS_ERR_CREATING_ALERTS_CONFIG = "Error creating alerts configuration"
Expand Down
10 changes: 4 additions & 6 deletions api/invite.go
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ func (a *Api) AcceptInvite(res http.ResponseWriter, req *http.Request, vars map[
log.Printf("AcceptInvite error validating CareTeamContext: %s", err)
a.sendModelAsResWithStatus(
res,
&status.StatusError{Status: status.NewStatus(http.StatusForbidden, statusForbiddenMessage)},
&status.StatusError{Status: status.NewStatus(http.StatusBadRequest, STATUS_ERR_VALIDATING_CONTEXT)},
http.StatusForbidden,
)
return
Expand Down Expand Up @@ -485,7 +485,7 @@ func (a *Api) SendInvite(res http.ResponseWriter, req *http.Request, vars map[st

invite, err := models.NewConfirmationWithContext(models.TypeCareteamInvite, templateName, invitorID, ib.CareTeamContext)
if err != nil {
statusErr := &status.StatusError{Status: status.NewStatus(http.StatusConflict, statusInternalServerErrorMessage)}
statusErr := &status.StatusError{Status: status.NewStatus(http.StatusInternalServerError, statusInternalServerErrorMessage)}
a.sendModelAsResWithStatus(res, statusErr, http.StatusInternalServerError)
return
}
Expand All @@ -505,10 +505,8 @@ func (a *Api) SendInvite(res http.ResponseWriter, req *http.Request, vars map[st
a.sendModelAsResWithStatus(res, invite, http.StatusOK)
}

fullName := "Mickey Mouse"
if invite.Creator.Profile == nil {
log.Printf("no creator profile for the invite")
} else {
fullName := "Tidepool User"
if invite.Creator.Profile != nil {
fullName = invite.Creator.Profile.FullName
if invite.Creator.Profile.Patient.IsOtherPerson {
fullName = invite.Creator.Profile.Patient.FullName
Expand Down

0 comments on commit aca88cd

Please sign in to comment.