Skip to content

Commit

Permalink
feat(#979): Add MustGetHubFromContext()
Browse files Browse the repository at this point in the history
  • Loading branch information
kohnalex committed Feb 23, 2024
1 parent 2d0926f commit b80a4c1
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions fibersentry/sentry.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,10 @@ func New(config ...Config) fiber.Handler {
}
}

func MustGetHubFromContext(ctx *fiber.Ctx) *sentry.Hub {
return ctx.Locals(hubKey).(*sentry.Hub)
}

func GetHubFromContext(ctx *fiber.Ctx) *sentry.Hub {
hub, ok := ctx.Locals(hubKey).(*sentry.Hub)
if !ok {
Expand Down

0 comments on commit b80a4c1

Please sign in to comment.