Skip to content

Commit

Permalink
log internal server errors
Browse files Browse the repository at this point in the history
These are more or less impossible to diagnose without any log info.

BACK-2500
  • Loading branch information
ewollesen committed Jan 2, 2024
1 parent 73abcd0 commit 272417a
Show file tree
Hide file tree
Showing 2 changed files with 180 additions and 0 deletions.
3 changes: 3 additions & 0 deletions data/service/api/v1/alerts.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (

"github.com/tidepool-org/platform/alerts"
"github.com/tidepool-org/platform/data/service"
"github.com/tidepool-org/platform/log"
"github.com/tidepool-org/platform/permission"
"github.com/tidepool-org/platform/request"
platform "github.com/tidepool-org/platform/service"
Expand Down Expand Up @@ -100,6 +101,7 @@ func UpsertAlert(dCtx service.Context) {
ctx := r.Context()
authDetails := request.GetAuthDetails(ctx)
repo := dCtx.AlertsRepository()
lgr := log.LoggerFromContext(ctx)

if err := checkAuthentication(authDetails); err != nil {
dCtx.RespondWithError(platform.ErrorUnauthorized())
Expand Down Expand Up @@ -128,6 +130,7 @@ func UpsertAlert(dCtx service.Context) {
cfg := &alerts.Config{UserID: userID, FollowedUserID: followedUserID, Alerts: *a}
if err := repo.Upsert(ctx, cfg); err != nil {
dCtx.RespondWithError(platform.ErrorInternalServerFailure())
lgr.WithError(err).Error("upserting alerts config")
return
}
}
Expand Down
Loading

0 comments on commit 272417a

Please sign in to comment.