Skip to content

Commit

Permalink
fix: add error logging
Browse files Browse the repository at this point in the history
  • Loading branch information
katallaxie committed Jul 3, 2024
1 parent 7508a73 commit e60f9a1
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions goth.go
Original file line number Diff line number Diff line change
Expand Up @@ -231,19 +231,22 @@ func (CompleteAuthCompleteHandler) New(cfg Config) fiber.Handler {

user, err := provider.CompleteAuth(c.Context(), cfg.Adapter, &Params{ctx: c})
if err != nil {
log.Error(err)
return cfg.ErrorHandler(c, ErrMissingUser)
}

log.Infow("", "user", user.Email)

duration, err := time.ParseDuration(cfg.Expiry)
if err != nil {
log.Error(err)
return cfg.ErrorHandler(c, ErrMissingSession)
}
expires := time.Now().Add(duration)

session, err := cfg.Adapter.CreateSession(c.Context(), user.ID, expires)
if err != nil {
log.Error(err)
return cfg.ErrorHandler(c, ErrMissingSession)
}

Expand Down

0 comments on commit e60f9a1

Please sign in to comment.