Skip to content

Commit

Permalink
master | add tracing sentry optional
Browse files Browse the repository at this point in the history
  • Loading branch information
edutomesco committed Oct 4, 2024
1 parent b10d787 commit 6c58056
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion internal/platform/server/error/api_error.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package api_error

import (
"bloock-identity-managed-api/internal/config"
"github.com/getsentry/sentry-go"
"net/http"
)
@@ -24,6 +25,8 @@ func NewUnauthorizedAPIError(message string) *APIError {
return &APIError{Status: http.StatusUnauthorized, Message: message}
}
func NewInternalServerAPIError(error error) *APIError {
sentry.CaptureException(error)
if config.Configuration.Tracing.Enabled {
sentry.CaptureException(error)
}
return &APIError{Status: http.StatusInternalServerError, Message: error.Error()}
}

0 comments on commit 6c58056

Please sign in to comment.