feat: capture logged exceptions and integrate storage-server with sentry

This commit is contained in:
2023-10-19 21:47:09 +02:00
parent efb8ba8b99
commit 1544212ab5
32 changed files with 172 additions and 113 deletions

View File

@ -42,7 +42,7 @@ func AnonymousUser(key jwk.Key, signingAlgorithm jwa.SignatureAlgorithm, funcs .
uuid, err := uuid.NewUUID()
if err != nil {
logger.Error(ctx, "could not generate uuid for anonymous user", logger.E(errors.WithStack(err)))
logger.Error(ctx, "could not generate uuid for anonymous user", logger.CapturedE(errors.WithStack(err)))
http.Error(w, http.StatusText(http.StatusInternalServerError), http.StatusInternalServerError)
return
@ -51,7 +51,7 @@ func AnonymousUser(key jwk.Key, signingAlgorithm jwa.SignatureAlgorithm, funcs .
subject := fmt.Sprintf("%s-%s", AnonIssuer, uuid.String())
preferredUsername, err := generateRandomPreferredUsername(8)
if err != nil {
logger.Error(ctx, "could not generate preferred username for anonymous user", logger.E(errors.WithStack(err)))
logger.Error(ctx, "could not generate preferred username for anonymous user", logger.CapturedE(errors.WithStack(err)))
http.Error(w, http.StatusText(http.StatusInternalServerError), http.StatusInternalServerError)
return
@ -68,7 +68,7 @@ func AnonymousUser(key jwk.Key, signingAlgorithm jwa.SignatureAlgorithm, funcs .
token, err := jwtutil.SignedToken(key, signingAlgorithm, claims)
if err != nil {
logger.Error(ctx, "could not generate signed token", logger.E(errors.WithStack(err)))
logger.Error(ctx, "could not generate signed token", logger.CapturedE(errors.WithStack(err)))
http.Error(w, http.StatusText(http.StatusInternalServerError), http.StatusInternalServerError)
return
@ -76,7 +76,7 @@ func AnonymousUser(key jwk.Key, signingAlgorithm jwa.SignatureAlgorithm, funcs .
cookieDomain, err := opts.GetCookieDomain(r)
if err != nil {
logger.Error(ctx, "could not retrieve cookie domain", logger.E(errors.WithStack(err)))
logger.Error(ctx, "could not retrieve cookie domain", logger.CapturedE(errors.WithStack(err)))
http.Error(w, http.StatusText(http.StatusInternalServerError), http.StatusInternalServerError)
return